summaryrefslogtreecommitdiff
path: root/zen/stl_tools.h
diff options
context:
space:
mode:
Diffstat (limited to 'zen/stl_tools.h')
-rw-r--r--zen/stl_tools.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/zen/stl_tools.h b/zen/stl_tools.h
index 07fc31d7..b394b128 100644
--- a/zen/stl_tools.h
+++ b/zen/stl_tools.h
@@ -18,7 +18,6 @@
#endif
-
//enhancements for <algorithm>
namespace zen
{
@@ -47,6 +46,10 @@ template <class BidirectionalIterator1, class BidirectionalIterator2>
BidirectionalIterator1 search_last(BidirectionalIterator1 first1, BidirectionalIterator1 last1,
BidirectionalIterator2 first2, BidirectionalIterator2 last2);
+template <class InputIterator1, class InputIterator2>
+bool equal(InputIterator1 first1, InputIterator1 last1,
+ InputIterator2 first2, InputIterator2 last2);
+
//hash container: proper name + mitigate MSVC performance bug
template <class T> class hash_set;
template <class K, class V> class hash_map;
@@ -166,6 +169,14 @@ BidirectionalIterator1 search_last(const BidirectionalIterator1 first1, Bidirect
}
+template <class InputIterator1, class InputIterator2> inline
+bool equal(InputIterator1 first1, InputIterator1 last1,
+ InputIterator2 first2, InputIterator2 last2)
+{
+ return last1 - first1 == last2 - first2 && std::equal(first1, last1, first2);
+}
+
+
#if defined _MSC_VER && _MSC_VER <= 1600 //VS2010 performance bug in std::unordered_set<>: http://drdobbs.com/blogs/cpp/232200410 -> should be fixed in VS11
template <class T> class hash_set : public std::set<T> {};
template <class K, class V> class hash_map : public std::map<K, V> {};
bgstack15