Use std::advance in test::next, and use it instead of boost::next

Mainly to avoid warnings from boost::next
This commit is contained in:
Daniel James committed 2017-12-01 08:35:38 +00:00
1 parent ecd5b239a4
commit 9bb861accc
3 files changed
+14 -14

No files matched your search

+6 -4
View File
@@ -6,6 +6,8 @@
#if !defined(BOOST_UNORDERED_TEST_HELPERS_HEADER)
#define BOOST_UNORDERED_TEST_HELPERS_HEADER
#include <iterator>
namespace test {
template <class Container> struct get_key_impl
{
@@ -36,16 +38,16 @@ namespace test {
// test::next
//
// Increments an iterator by 1 or a given value.
// Like boost::next, but simpler and slower.
// Like boost::next, but simpler.
// Mainly because boost::next uses an MPL file
// which causes warnings.
template <typename Iterator> Iterator next(Iterator it) { return ++it; }
template <typename Iterator, typename IntType>
Iterator next(Iterator it, IntType x)
{
for (; x > 0; --x) {
++it;
}
std::advance(it, x);
return it;
}
}