diff -r 8fb1c657e0b0 -r d9073c13dc98 sources/range.h --- a/sources/range.h Wed Jul 20 13:29:03 2016 +0300 +++ b/sources/range.h Wed Jul 20 15:03:37 2016 +0300 @@ -67,7 +67,7 @@ bool operator!= (const Iterator& other) const { - return value != other.value; + return value < other.value; } Iterator& operator++() @@ -90,18 +90,12 @@ Iterator begin() const { - Iterator it; - it.value = min(); - it.step = m_step; - return it; + return Iterator(min(), m_step); } Iterator end() const { - Iterator it; - it.value = max() + 1; - it.step = m_step; - return it; + return Iterator(max(), m_step); } T min() const @@ -150,4 +144,16 @@ } }; +template +Range range(T a, T b, T step = 1) +{ + return Range(a, b, step); +} + +template +Range range(T b) +{ + return Range(T(), b); +} + END_ZFC_NAMESPACE