sources/range.h

changeset 5
146825d63b9a
parent 1
4dd5bde4e777
child 69
eb4c25284a19
--- 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<T> const& other) const -> bool;
 	METHOD operator== (Range<T> const& other) const -> bool;
 	METHOD operator!= (Range<T> const& other) const -> bool;
 };
 
-//
-// -------------------------------------------------------------------------------------------------
-//
-
-template<typename T> inline METHOD
-Range<T>::Iterator::operator*() -> T&
-{
-	return value;
-}
-
-//
-// -------------------------------------------------------------------------------------------------
-//
-
-template<typename T> inline METHOD
-Range<T>::Iterator::operator== (const Iterator& other) const -> bool
-{
-	return value == other.value;
-}
-
-//
 // -------------------------------------------------------------------------------------------------
 //
-
-template<typename T> inline METHOD
-Range<T>::Iterator::operator!= (const Iterator& other) const -> bool
-{
-	return value != other.value;
-}
-
-//
-// -------------------------------------------------------------------------------------------------
-//
-
-template<typename T> inline METHOD
-Range<T>::Iterator::operator++() -> Iterator&
-{
-	value += step;
-	return *this;
-}
-
-//
-// -------------------------------------------------------------------------------------------------
-//
-
 template<typename T>
 Range<T>::Range (const T& a, const T& b, const T& step) :
 	m_a (a),
@@ -123,19 +80,48 @@
 	check_bounds();
 }
 
-//
 // -------------------------------------------------------------------------------------------------
 //
-
 template<typename T>
 Range<T>::Range() :
 	m_a (T()),
 	m_b (T()) {}
 
+// -------------------------------------------------------------------------------------------------
 //
+template<typename T> inline METHOD
+Range<T>::Iterator::operator*() -> T&
+{
+	return value;
+}
+
+// -------------------------------------------------------------------------------------------------
+//
+template<typename T> inline METHOD
+Range<T>::Iterator::operator== (const Iterator& other) const -> bool
+{
+	return value == other.value;
+}
+
 // -------------------------------------------------------------------------------------------------
 //
+template<typename T> inline METHOD
+Range<T>::Iterator::operator!= (const Iterator& other) const -> bool
+{
+	return value != other.value;
+}
 
+// -------------------------------------------------------------------------------------------------
+//
+template<typename T> inline METHOD
+Range<T>::Iterator::operator++() -> Iterator&
+{
+	value += step;
+	return *this;
+}
+
+// -------------------------------------------------------------------------------------------------
+//
 template<typename T> METHOD
 Range<T>::check_bounds() -> void
 {
@@ -143,80 +129,64 @@
 		std::swap (m_a, m_b);
 }
 
-//
 // -------------------------------------------------------------------------------------------------
 //
-
 template<typename T> METHOD
 Range<T>::contains (const T& c) const -> bool
 {
 	return (c >= m_a) and (c <= m_b);
 }
 
-//
 // -------------------------------------------------------------------------------------------------
 //
-
 template<typename T> METHOD
-Range<T>::contains_exclusive (const T& c) const -> bool
+Range<T>::contains_exclusively (const T& c) const -> bool
 {
 	return (c > m_a) and (c < m_b);
 }
 
-//
 // -------------------------------------------------------------------------------------------------
 //
-
 template<typename T> METHOD
 Range<T>::overlaps (Range<T> const& other) const -> bool
 {
 	return contains (other.m_a) or contains (other.m_b);
 }
 
-//
 // -------------------------------------------------------------------------------------------------
 //
-
 template<typename T> METHOD
 Range<T>::operator== (Range<T> const& other) const -> bool
 {
 	return m_a == other.m_a and m_b == other.m_b;
 }
 
-//
 // -------------------------------------------------------------------------------------------------
 //
-
 template<typename T> METHOD
 Range<T>::operator!= (Range<T> const& other) const -> bool
 {
 	return not operator== (other);
 }
 
-//
 // -------------------------------------------------------------------------------------------------
 //
-
 template<typename T> METHOD
 Range<T>::min() const -> T
 {
 	return m_a;
 }
 
-//
 // -------------------------------------------------------------------------------------------------
 //
-
 template<typename T> METHOD
 Range<T>::max() const -> T
 {
 	return m_b;
 }
 
-//
 // -------------------------------------------------------------------------------------------------
 //
-
 template<typename T> METHOD
 Range<T>::begin() const -> Iterator
 {
@@ -226,10 +196,8 @@
 	return it;
 }
 
-//
 // -------------------------------------------------------------------------------------------------
 //
-
 template<typename T> METHOD
 Range<T>::end() const -> Iterator
 {

mercurial