sources/list.h

changeset 88
08ccaf26cffd
parent 87
53c2aecb9704
child 109
e4966d7e615d
--- a/sources/list.h	Thu Jul 23 00:16:47 2015 +0300
+++ b/sources/list.h	Thu Jul 23 01:52:04 2015 +0300
@@ -36,6 +36,7 @@
 #include <cassert>
 #include <vector>
 #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<T, C>;
+	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<T, C> Self;
 
 	Container(){}
 
@@ -70,7 +71,7 @@
 
 	ConstIterator begin() const
 	{
-		return m_container.cbegin();
+		return m_container.begin();
 	}
 
 	void clear()
@@ -80,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
@@ -105,7 +106,7 @@
 
 	ConstIterator end() const
 	{
-		return m_container.cend();
+		return m_container.end();
 	}
 
 	Iterator find (const T& needle)
@@ -120,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<bool (T const&)> func)
+	Iterator find (bool (*func)(T const&))
 	{
 		for (Iterator it = begin(); it != end(); ++it)
 		{
@@ -139,7 +140,7 @@
 		return end();
 	}
 
-	ConstIterator find (Function<bool (T const&)> func) const
+	ConstIterator find (bool (*func)(T const&)) const
 	{
 		for (ConstIterator it = begin(); it != end(); ++it)
 		{
@@ -369,3 +370,5 @@
 		return data();
 	}
 };
+
+END_ZFC_NAMESPACE

mercurial