diff -r a76af67a3a4b -r 7b156b764d11 sources/list.h --- a/sources/list.h Sat Jan 09 02:35:00 2016 +0200 +++ b/sources/list.h Sat Jan 09 17:41:21 2016 +0200 @@ -32,10 +32,11 @@ #include "basics.h" #include #include -#include #include #include +#include #include "range.h" +BEGIN_ZFC_NAMESPACE // ------------------------------------------------------------------------------------------------- // @@ -43,11 +44,11 @@ class Container { public: - using Iterator = typename C::iterator; - using ConstIterator = typename C::const_iterator; - using ReverseIterator = typename C::reverse_iterator; - using ConstReverseIterator = typename C::const_reverse_iterator; - using Self = Container; + typedef typename C::iterator Iterator; + typedef typename C::const_iterator ConstIterator; + typedef typename C::reverse_iterator ReverseIterator; + typedef typename C::const_reverse_iterator ConstReverseIterator; + typedef Container Self; Container(){} @@ -57,9 +58,6 @@ Container (const C& other) : m_container (other) {} - Container (std::initializer_list&& a) : - m_container (a) {} - T& append (const T& value) { m_container.push_back (value); @@ -73,7 +71,7 @@ ConstIterator begin() const { - return m_container.cbegin(); + return m_container.begin(); } void clear() @@ -83,17 +81,17 @@ bool contains (const T& a) const { - return std::find (m_container.cbegin(), m_container.cend(), a) != m_container.end(); + return std::find (m_container.begin(), m_container.end(), a) != m_container.end(); } ConstReverseIterator crbegin() const { - return m_container.crbegin(); + return m_container.rbegin(); } ConstReverseIterator crend() const { - return m_container.crbegin(); + return m_container.rend(); } const C& container() const @@ -108,7 +106,7 @@ ConstIterator end() const { - return m_container.cend(); + return m_container.end(); } Iterator find (const T& needle) @@ -123,15 +121,15 @@ ConstIterator find (const T& needle) const { - auto it = std::find (m_container.cbegin(), m_container.cend(), needle); + auto it = std::find (m_container.begin(), m_container.end(), needle); - if (it == m_container.cend()) + if (it == m_container.end()) return end(); return it; } - Iterator find (Function func) + Iterator find (bool (*func)(T const&)) { for (Iterator it = begin(); it != end(); ++it) { @@ -142,7 +140,7 @@ return end(); } - ConstIterator find (Function func) const + ConstIterator find (bool (*func)(T const&)) const { for (ConstIterator it = begin(); it != end(); ++it) { @@ -329,17 +327,28 @@ // template -using List = Container>; +class List : public Container > +{ +public: + typedef Container > Super; + + List(){} + + List (int numvalues) : + Super (numvalues) {} + + List (const Super& other) : + Super (other) {} +}; // ------------------------------------------------------------------------------------------------- // template -class Vector : public Container> +class Vector : public Container > { public: - using Super = Container>; - using typename Super::Container; + typedef Container > Super; Vector(){} @@ -361,3 +370,5 @@ return data(); } }; + +END_ZFC_NAMESPACE