summaryrefslogtreecommitdiff
path: root/libs/container/test/check_equal_containers.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/container/test/check_equal_containers.hpp')
-rw-r--r--libs/container/test/check_equal_containers.hpp31
1 files changed, 18 insertions, 13 deletions
diff --git a/libs/container/test/check_equal_containers.hpp b/libs/container/test/check_equal_containers.hpp
index b742891b9..0f67a6a4e 100644
--- a/libs/container/test/check_equal_containers.hpp
+++ b/libs/container/test/check_equal_containers.hpp
@@ -14,11 +14,11 @@
#include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/pair.hpp>
#include <boost/container/detail/mpl.hpp>
-#include <functional>
-#include <iostream>
-#include <algorithm>
#include <boost/move/unique_ptr.hpp>
+#include <cstddef>
+#include <boost/container/detail/iterator.hpp>
+
namespace boost{
namespace container {
namespace test{
@@ -59,22 +59,26 @@ bool CheckEqual( const Pair1 &pair1, const Pair2 &pair2
}
//Function to check if both containers are equal
-template<class MyBoostCont
- ,class MyStdCont>
-bool CheckEqualContainers(const MyBoostCont &boostcont, const MyStdCont &stdcont)
+template<class ContA
+ ,class ContB>
+bool CheckEqualContainers(const ContA &cont_a, const ContB &cont_b)
{
- if(boostcont.size() != stdcont.size())
+ if(cont_a.size() != cont_b.size())
return false;
- typename MyBoostCont::const_iterator itboost(boostcont.begin()), itboostend(boostcont.end());
- typename MyStdCont::const_iterator itstd(stdcont.begin());
- typename MyStdCont::size_type dist = (typename MyStdCont::size_type)std::distance(itboost, itboostend);
- if(dist != boostcont.size()){
+ typename ContA::const_iterator itcont_a(cont_a.begin()), itcont_a_end(cont_a.end());
+ typename ContB::const_iterator itcont_b(cont_b.begin()), itcont_b_end(cont_b.end());;
+ typename ContB::size_type dist = (typename ContB::size_type)boost::container::iterator_distance(itcont_a, itcont_a_end);
+ if(dist != cont_a.size()){
+ return false;
+ }
+ typename ContA::size_type dist2 = (typename ContA::size_type)boost::container::iterator_distance(itcont_b, itcont_b_end);
+ if(dist2 != cont_b.size()){
return false;
}
std::size_t i = 0;
- for(; itboost != itboostend; ++itboost, ++itstd, ++i){
- if(!CheckEqual(*itstd, *itboost))
+ for(; itcont_a != itcont_a_end; ++itcont_a, ++itcont_b, ++i){
+ if(!CheckEqual(*itcont_a, *itcont_b))
return false;
}
return true;
@@ -101,6 +105,7 @@ bool CheckEqualPairContainers(const MyBoostCont &boostcont, const MyStdCont &std
}
return true;
}
+
} //namespace test{
} //namespace container {
} //namespace boost{