diff -r ec5387e121fa -r 146825d63b9a sources/list.h --- a/sources/list.h Wed Dec 10 19:26:13 2014 +0200 +++ b/sources/list.h Thu Dec 11 05:58:55 2014 +0200 @@ -37,10 +37,8 @@ #include #include "range.h" -// // ------------------------------------------------------------------------------------------------- // - template class Container { @@ -141,114 +139,90 @@ template Container::Container() {} -// // ------------------------------------------------------------------------------------------------- // - template Container::Container (const C& other) : m_container (other) {} -// // ------------------------------------------------------------------------------------------------- // - template Container::Container (std::initializer_list && a) : m_container (a) {} -// // ------------------------------------------------------------------------------------------------- // - template Container::Container (int numvalues) : m_container (numvalues) {} -// // ------------------------------------------------------------------------------------------------- // - template auto Container::begin() -> Iterator { return m_container.begin(); } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::begin() const -> ConstIterator { return m_container.cbegin(); } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::end() -> Iterator { return m_container.end(); } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::end() const -> ConstIterator { return m_container.cend(); } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::rbegin() -> ReverseIterator { return m_container.rbegin(); } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::crbegin() const -> ConstReverseIterator { return m_container.crbegin(); } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::rend() -> ReverseIterator { return m_container.rend(); } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::crend() const -> ConstReverseIterator { return m_container.crend(); } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::remove_at (int pos) -> void { @@ -256,10 +230,8 @@ m_container.erase (m_container.begin() + pos); } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::prepend (const T& value) -> T& { @@ -267,10 +239,8 @@ return m_container[0]; } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::append (const T& value) -> T& { @@ -278,10 +248,8 @@ return m_container[m_container.size() - 1]; } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::merge (const Self& other) -> void { @@ -290,10 +258,8 @@ std::copy (other.begin(), other.end(), begin() + oldsize); } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::pop (T& val) -> bool { @@ -305,10 +271,8 @@ return true; } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::operator<< (const T& value) -> Self& { @@ -316,10 +280,8 @@ return *this; } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::operator<< (const Self& vals) -> Self& { @@ -327,10 +289,8 @@ return *this; } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::reverse() const -> Self { @@ -339,30 +299,24 @@ return rev; } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::clear() -> void { m_container.clear(); } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::insert (int pos, const T& value) -> void { m_container.insert (m_container.begin() + pos, value); } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::remove_duplicates() -> void { @@ -370,20 +324,16 @@ resize (std::distance (begin(), std::unique (begin(), end()))); } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::size() const -> int { return m_container.size(); } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::operator[] (int n) -> T& { @@ -391,10 +341,8 @@ return m_container[n]; } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::operator[] (int n) const -> const T& { @@ -402,40 +350,32 @@ return m_container[n]; } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::operator[] (const Range& n) const -> Self { return splice (n); } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::resize (int size) -> void { m_container.resize (size); } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::sort() -> void { std::sort (begin(), end()); } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::find (const T& needle) -> Iterator { @@ -447,10 +387,8 @@ return it; } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::find (const T& needle) const -> ConstIterator { @@ -462,10 +400,8 @@ return it; } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::find (Function func) -> Iterator { @@ -478,10 +414,8 @@ return end(); } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::find (Function func) const -> ConstIterator { @@ -494,10 +428,8 @@ return end(); } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::remove_one (const T& a) -> void { @@ -507,20 +439,16 @@ m_container.erase (it); } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::is_empty() const -> bool { return size() == 0; } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::splice (int a, int b) const -> Self { @@ -535,60 +463,48 @@ return result; } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::splice (const Range& a) const -> Self { return splice (a.min(), a.max()); } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::container() const -> const C& { return m_container; } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::first() const -> const T& { return *m_container.cbegin(); } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::last() const -> const T& { return *(m_container.cend() - 1); } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::contains (const T& a) const -> bool { return std::find (m_container.cbegin(), m_container.cend(), a) != m_container.end(); } -// // ------------------------------------------------------------------------------------------------- // - template auto Container::operator+ (const Self& other) const -> Self { @@ -597,10 +513,8 @@ return out; } -// // ------------------------------------------------------------------------------------------------- // - template auto operator>> (const T& value, Container& haystack) -> Container& {