diff -r ec5387e121fa -r 146825d63b9a sources/range.h --- a/sources/range.h Wed Dec 10 19:26:13 2014 +0200 +++ b/sources/range.h Thu Dec 11 05:58:55 2014 +0200 @@ -63,57 +63,14 @@ METHOD max() const -> T; METHOD check_bounds() -> void; METHOD contains (const T& c) const -> bool; - METHOD contains_exclusive (const T& c) const -> bool; + METHOD contains_exclusively (const T& c) const -> bool; METHOD overlaps (Range const& other) const -> bool; METHOD operator== (Range const& other) const -> bool; METHOD operator!= (Range const& other) const -> bool; }; -// -// ------------------------------------------------------------------------------------------------- -// - -template inline METHOD -Range::Iterator::operator*() -> T& -{ - return value; -} - -// -// ------------------------------------------------------------------------------------------------- -// - -template inline METHOD -Range::Iterator::operator== (const Iterator& other) const -> bool -{ - return value == other.value; -} - -// // ------------------------------------------------------------------------------------------------- // - -template inline METHOD -Range::Iterator::operator!= (const Iterator& other) const -> bool -{ - return value != other.value; -} - -// -// ------------------------------------------------------------------------------------------------- -// - -template inline METHOD -Range::Iterator::operator++() -> Iterator& -{ - value += step; - return *this; -} - -// -// ------------------------------------------------------------------------------------------------- -// - template Range::Range (const T& a, const T& b, const T& step) : m_a (a), @@ -123,19 +80,48 @@ check_bounds(); } -// // ------------------------------------------------------------------------------------------------- // - template Range::Range() : m_a (T()), m_b (T()) {} +// ------------------------------------------------------------------------------------------------- // +template inline METHOD +Range::Iterator::operator*() -> T& +{ + return value; +} + +// ------------------------------------------------------------------------------------------------- +// +template inline METHOD +Range::Iterator::operator== (const Iterator& other) const -> bool +{ + return value == other.value; +} + // ------------------------------------------------------------------------------------------------- // +template inline METHOD +Range::Iterator::operator!= (const Iterator& other) const -> bool +{ + return value != other.value; +} +// ------------------------------------------------------------------------------------------------- +// +template inline METHOD +Range::Iterator::operator++() -> Iterator& +{ + value += step; + return *this; +} + +// ------------------------------------------------------------------------------------------------- +// template METHOD Range::check_bounds() -> void { @@ -143,80 +129,64 @@ std::swap (m_a, m_b); } -// // ------------------------------------------------------------------------------------------------- // - template METHOD Range::contains (const T& c) const -> bool { return (c >= m_a) and (c <= m_b); } -// // ------------------------------------------------------------------------------------------------- // - template METHOD -Range::contains_exclusive (const T& c) const -> bool +Range::contains_exclusively (const T& c) const -> bool { return (c > m_a) and (c < m_b); } -// // ------------------------------------------------------------------------------------------------- // - template METHOD Range::overlaps (Range const& other) const -> bool { return contains (other.m_a) or contains (other.m_b); } -// // ------------------------------------------------------------------------------------------------- // - template METHOD Range::operator== (Range const& other) const -> bool { return m_a == other.m_a and m_b == other.m_b; } -// // ------------------------------------------------------------------------------------------------- // - template METHOD Range::operator!= (Range const& other) const -> bool { return not operator== (other); } -// // ------------------------------------------------------------------------------------------------- // - template METHOD Range::min() const -> T { return m_a; } -// // ------------------------------------------------------------------------------------------------- // - template METHOD Range::max() const -> T { return m_b; } -// // ------------------------------------------------------------------------------------------------- // - template METHOD Range::begin() const -> Iterator { @@ -226,10 +196,8 @@ return it; } -// // ------------------------------------------------------------------------------------------------- // - template METHOD Range::end() const -> Iterator {