mirror of
https://github.com/boostorg/range.git
synced 2025-07-23 09:27:17 +02:00
[boost][range] - Improved handling of temporary ranges in range algorithms.
[SVN r63903]
This commit is contained in:
@ -9,7 +9,7 @@
|
|||||||
// For more information, see http://www.boost.org/libs/range/
|
// For more information, see http://www.boost.org/libs/range/
|
||||||
//
|
//
|
||||||
#include <boost/range/algorithm/adjacent_find.hpp>
|
#include <boost/range/algorithm/adjacent_find.hpp>
|
||||||
|
#include <boost/range/iterator_range.hpp>
|
||||||
#include <boost/test/test_tools.hpp>
|
#include <boost/test/test_tools.hpp>
|
||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/unit_test.hpp>
|
||||||
|
|
||||||
@ -38,14 +38,18 @@ namespace boost
|
|||||||
|
|
||||||
BOOST_CHECK( boost::adjacent_find(cont) == cont.end() );
|
BOOST_CHECK( boost::adjacent_find(cont) == cont.end() );
|
||||||
BOOST_CHECK( boost::adjacent_find(cref_cont) == cref_cont.end() );
|
BOOST_CHECK( boost::adjacent_find(cref_cont) == cref_cont.end() );
|
||||||
|
BOOST_CHECK( boost::adjacent_find(boost::make_iterator_range(cont)) == cont.end() );
|
||||||
BOOST_CHECK( boost::adjacent_find(cont, pred) == cont.end() );
|
BOOST_CHECK( boost::adjacent_find(cont, pred) == cont.end() );
|
||||||
BOOST_CHECK( boost::adjacent_find(cref_cont, pred) == cref_cont.end() );
|
BOOST_CHECK( boost::adjacent_find(cref_cont, pred) == cref_cont.end() );
|
||||||
|
BOOST_CHECK( boost::adjacent_find(boost::make_iterator_range(cont), pred) == cont.end() );
|
||||||
|
|
||||||
cont += 1;
|
cont += 1;
|
||||||
BOOST_CHECK( boost::adjacent_find(cont) == cont.end() );
|
BOOST_CHECK( boost::adjacent_find(cont) == cont.end() );
|
||||||
BOOST_CHECK( boost::adjacent_find(cref_cont) == cref_cont.end() );
|
BOOST_CHECK( boost::adjacent_find(cref_cont) == cref_cont.end() );
|
||||||
|
BOOST_CHECK( boost::adjacent_find(boost::make_iterator_range(cont)) == cont.end() );
|
||||||
BOOST_CHECK( boost::adjacent_find(cont, pred) == cont.end() );
|
BOOST_CHECK( boost::adjacent_find(cont, pred) == cont.end() );
|
||||||
BOOST_CHECK( boost::adjacent_find(cref_cont, pred) == cref_cont.end() );
|
BOOST_CHECK( boost::adjacent_find(cref_cont, pred) == cref_cont.end() );
|
||||||
|
BOOST_CHECK( boost::adjacent_find(boost::make_iterator_range(cont), pred) == cont.end() );
|
||||||
|
|
||||||
cont += 2,3,4,5,5,5,6,7,8,9;
|
cont += 2,3,4,5,5,5,6,7,8,9;
|
||||||
iterator_t it = boost::adjacent_find(cont);
|
iterator_t it = boost::adjacent_find(cont);
|
||||||
@ -57,6 +61,8 @@ namespace boost
|
|||||||
{
|
{
|
||||||
BOOST_CHECK( *it == 5 );
|
BOOST_CHECK( *it == 5 );
|
||||||
}
|
}
|
||||||
|
BOOST_CHECK( it == boost::adjacent_find(boost::make_iterator_range(cont)) );
|
||||||
|
BOOST_CHECK( it_pred == boost::adjacent_find(boost::make_iterator_range(cont), pred) );
|
||||||
const_iterator_t cit = boost::adjacent_find(cref_cont);
|
const_iterator_t cit = boost::adjacent_find(cref_cont);
|
||||||
const_iterator_t cit_pred = boost::adjacent_find(cref_cont, pred);
|
const_iterator_t cit_pred = boost::adjacent_find(cref_cont, pred);
|
||||||
BOOST_CHECK( cit == cit_pred );
|
BOOST_CHECK( cit == cit_pred );
|
||||||
|
@ -37,6 +37,8 @@ namespace boost
|
|||||||
|
|
||||||
BOOST_CHECK( reference_result == test_result );
|
BOOST_CHECK( reference_result == test_result );
|
||||||
|
|
||||||
|
BOOST_CHECK( test_result == boost::binary_search(boost::make_iterator_range(test), 5) );
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS(
|
BOOST_CHECK_EQUAL_COLLECTIONS(
|
||||||
reference.begin(), reference.end(),
|
reference.begin(), reference.end(),
|
||||||
test.begin(), test.end()
|
test.begin(), test.end()
|
||||||
@ -68,6 +70,8 @@ namespace boost
|
|||||||
|
|
||||||
bool test_result = boost::binary_search(test, 5, pred);
|
bool test_result = boost::binary_search(test, 5, pred);
|
||||||
|
|
||||||
|
BOOST_CHECK( test_result == boost::binary_search(boost::make_iterator_range(test), 5, pred) );
|
||||||
|
|
||||||
BOOST_CHECK( reference_result == test_result );
|
BOOST_CHECK( reference_result == test_result );
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS(
|
BOOST_CHECK_EQUAL_COLLECTIONS(
|
||||||
|
@ -42,6 +42,13 @@ namespace boost
|
|||||||
target.begin(), target.end(),
|
target.begin(), target.end(),
|
||||||
source.begin(), source.end()
|
source.begin(), source.end()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
it == boost::copy(boost::make_iterator_range(source), target.begin());
|
||||||
|
|
||||||
|
BOOST_CHECK( it == target.end() );
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS(target.begin(), target.end(),
|
||||||
|
source.begin(), source.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_copy()
|
void test_copy()
|
||||||
|
@ -39,6 +39,10 @@ namespace boost
|
|||||||
BOOST_CHECK( it == target.end() );
|
BOOST_CHECK( it == target.end() );
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS( target.begin(), target.end(),
|
BOOST_CHECK_EQUAL_COLLECTIONS( target.begin(), target.end(),
|
||||||
source.rbegin(), source.rend() );
|
source.rbegin(), source.rend() );
|
||||||
|
|
||||||
|
BOOST_CHECK( it == boost::copy_backward(boost::make_iterator_range(source), target.begin()) );
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( target.begin(), target.end(),
|
||||||
|
source.rbegin(), source.rend() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_copy_backward()
|
void test_copy_backward()
|
||||||
|
@ -40,6 +40,13 @@ namespace
|
|||||||
target.begin(), target.end(),
|
target.begin(), target.end(),
|
||||||
source.begin(), source.end()
|
source.begin(), source.end()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
it = boost::copy(boost::make_iterator_range(source), target.begin());
|
||||||
|
|
||||||
|
BOOST_CHECK( it == target.end() );
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS(target.begin(), target.end(),
|
||||||
|
source.begin(), source.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_copy_n()
|
void test_copy_n()
|
||||||
|
@ -31,28 +31,36 @@ namespace boost
|
|||||||
Container cont;
|
Container cont;
|
||||||
const Container& cref_cont = cont;
|
const Container& cref_cont = cont;
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL( 0u, boost::count(cont, 0) );
|
BOOST_CHECK_EQUAL( 0u, boost::count(cont, 0u) );
|
||||||
BOOST_CHECK_EQUAL( 0u, boost::count(cref_cont, 0) );
|
BOOST_CHECK_EQUAL( 0u, boost::count(cref_cont, 0u) );
|
||||||
|
BOOST_CHECK_EQUAL( 0u, boost::count(boost::make_iterator_range(cont), 0u) );
|
||||||
|
|
||||||
cont += 1;
|
cont += 1;
|
||||||
BOOST_CHECK_EQUAL( 0u, boost::count(cont, 0) );
|
BOOST_CHECK_EQUAL( 0u, boost::count(cont, 0u) );
|
||||||
BOOST_CHECK_EQUAL( 0u, boost::count(cref_cont, 0) );
|
BOOST_CHECK_EQUAL( 0u, boost::count(cref_cont, 0u) );
|
||||||
BOOST_CHECK_EQUAL( 1u, boost::count(cont, 1) );
|
BOOST_CHECK_EQUAL( 0u, boost::count(boost::make_iterator_range(cont), 0u) );
|
||||||
BOOST_CHECK_EQUAL( 1u, boost::count(cref_cont, 1) );
|
BOOST_CHECK_EQUAL( 1u, boost::count(cont, 1u) );
|
||||||
|
BOOST_CHECK_EQUAL( 1u, boost::count(cref_cont, 1u) );
|
||||||
|
BOOST_CHECK_EQUAL( 1u, boost::count(boost::make_iterator_range(cont), 1u) );
|
||||||
|
|
||||||
cont += 2,3,4,5,6,7,8,9;
|
cont += 2,3,4,5,6,7,8,9;
|
||||||
BOOST_CHECK_EQUAL( 0u, boost::count(cont, 0) );
|
BOOST_CHECK_EQUAL( 0u, boost::count(cont, 0u) );
|
||||||
BOOST_CHECK_EQUAL( 0u, boost::count(cref_cont, 0) );
|
BOOST_CHECK_EQUAL( 0u, boost::count(cref_cont, 0u) );
|
||||||
BOOST_CHECK_EQUAL( 1u, boost::count(cont, 1) );
|
BOOST_CHECK_EQUAL( 0u, boost::count(boost::make_iterator_range(cont), 0u) );
|
||||||
BOOST_CHECK_EQUAL( 1u, boost::count(cref_cont, 1) );
|
BOOST_CHECK_EQUAL( 1u, boost::count(cont, 1u) );
|
||||||
|
BOOST_CHECK_EQUAL( 1u, boost::count(cref_cont, 1u) );
|
||||||
|
BOOST_CHECK_EQUAL( 1u, boost::count(boost::make_iterator_range(cont), 1u) );
|
||||||
|
|
||||||
cont += 2;
|
cont += 2;
|
||||||
BOOST_CHECK_EQUAL( 0u, boost::count(cont, 0) );
|
BOOST_CHECK_EQUAL( 0u, boost::count(cont, 0u) );
|
||||||
BOOST_CHECK_EQUAL( 0u, boost::count(cref_cont, 0) );
|
BOOST_CHECK_EQUAL( 0u, boost::count(cref_cont, 0u) );
|
||||||
BOOST_CHECK_EQUAL( 1u, boost::count(cont, 1) );
|
BOOST_CHECK_EQUAL( 0u, boost::count(boost::make_iterator_range(cont), 0u) );
|
||||||
BOOST_CHECK_EQUAL( 1u, boost::count(cref_cont, 1) );
|
BOOST_CHECK_EQUAL( 1u, boost::count(cont, 1u) );
|
||||||
BOOST_CHECK_EQUAL( 2u, boost::count(cont, 2) );
|
BOOST_CHECK_EQUAL( 1u, boost::count(cref_cont, 1u) );
|
||||||
BOOST_CHECK_EQUAL( 2u, boost::count(cref_cont, 2) );
|
BOOST_CHECK_EQUAL( 1u, boost::count(boost::make_iterator_range(cont), 1u) );
|
||||||
|
BOOST_CHECK_EQUAL( 2u, boost::count(cont, 2u) );
|
||||||
|
BOOST_CHECK_EQUAL( 2u, boost::count(cref_cont, 2u) );
|
||||||
|
BOOST_CHECK_EQUAL( 2u, boost::count(boost::make_iterator_range(cont), 2u) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_count()
|
void test_count()
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include <boost/assign.hpp>
|
#include <boost/assign.hpp>
|
||||||
#include "../test_function/false_predicate.hpp"
|
#include "../test_function/false_predicate.hpp"
|
||||||
|
#include "../test_function/true_predicate.hpp"
|
||||||
#include "../test_function/equal_to_x.hpp"
|
#include "../test_function/equal_to_x.hpp"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <list>
|
#include <list>
|
||||||
@ -38,29 +39,42 @@ namespace boost
|
|||||||
|
|
||||||
BOOST_CHECK_EQUAL( 0u, boost::count_if(cont, pred_t(0)) );
|
BOOST_CHECK_EQUAL( 0u, boost::count_if(cont, pred_t(0)) );
|
||||||
BOOST_CHECK_EQUAL( 0u, boost::count_if(cref_cont, pred_t(0)) );
|
BOOST_CHECK_EQUAL( 0u, boost::count_if(cref_cont, pred_t(0)) );
|
||||||
|
BOOST_CHECK_EQUAL( 0u, boost::count_if(boost::make_iterator_range(cont), pred_t(0)) );
|
||||||
|
|
||||||
cont += 1;
|
cont += 1;
|
||||||
BOOST_CHECK_EQUAL( 0u, boost::count_if(cont, pred_t(0)) );
|
BOOST_CHECK_EQUAL( 0u, boost::count_if(cont, pred_t(0)) );
|
||||||
BOOST_CHECK_EQUAL( 0u, boost::count_if(cref_cont, pred_t(0)) );
|
BOOST_CHECK_EQUAL( 0u, boost::count_if(cref_cont, pred_t(0)) );
|
||||||
|
BOOST_CHECK_EQUAL( 0u, boost::count_if(boost::make_iterator_range(cont), pred_t(0)) );
|
||||||
BOOST_CHECK_EQUAL( 1u, boost::count_if(cont, pred_t(1)) );
|
BOOST_CHECK_EQUAL( 1u, boost::count_if(cont, pred_t(1)) );
|
||||||
BOOST_CHECK_EQUAL( 1u, boost::count_if(cref_cont, pred_t(1)) );
|
BOOST_CHECK_EQUAL( 1u, boost::count_if(cref_cont, pred_t(1)) );
|
||||||
|
BOOST_CHECK_EQUAL( 1u, boost::count_if(boost::make_iterator_range(cont), pred_t(1)) );
|
||||||
|
|
||||||
cont += 2,3,4,5,6,7,8,9;
|
cont += 2,3,4,5,6,7,8,9;
|
||||||
BOOST_CHECK_EQUAL( 0u, boost::count_if(cont, pred_t(0)) );
|
BOOST_CHECK_EQUAL( 0u, boost::count_if(cont, pred_t(0)) );
|
||||||
BOOST_CHECK_EQUAL( 0u, boost::count_if(cref_cont, pred_t(0)) );
|
BOOST_CHECK_EQUAL( 0u, boost::count_if(cref_cont, pred_t(0)) );
|
||||||
|
BOOST_CHECK_EQUAL( 0u, boost::count_if(boost::make_iterator_range(cont), pred_t(0)) );
|
||||||
BOOST_CHECK_EQUAL( 1u, boost::count_if(cont, pred_t(1)) );
|
BOOST_CHECK_EQUAL( 1u, boost::count_if(cont, pred_t(1)) );
|
||||||
BOOST_CHECK_EQUAL( 1u, boost::count_if(cref_cont, pred_t(1)) );
|
BOOST_CHECK_EQUAL( 1u, boost::count_if(cref_cont, pred_t(1)) );
|
||||||
|
BOOST_CHECK_EQUAL( 1u, boost::count_if(boost::make_iterator_range(cont), pred_t(1)) );
|
||||||
|
|
||||||
cont += 2;
|
cont += 2;
|
||||||
BOOST_CHECK_EQUAL( 0u, boost::count_if(cont, pred_t(0)) );
|
BOOST_CHECK_EQUAL( 0u, boost::count_if(cont, pred_t(0)) );
|
||||||
BOOST_CHECK_EQUAL( 0u, boost::count_if(cref_cont, pred_t(0)) );
|
BOOST_CHECK_EQUAL( 0u, boost::count_if(cref_cont, pred_t(0)) );
|
||||||
|
BOOST_CHECK_EQUAL( 0u, boost::count_if(boost::make_iterator_range(cont), pred_t(0)) );
|
||||||
BOOST_CHECK_EQUAL( 1u, boost::count_if(cont, pred_t(1)) );
|
BOOST_CHECK_EQUAL( 1u, boost::count_if(cont, pred_t(1)) );
|
||||||
BOOST_CHECK_EQUAL( 1u, boost::count_if(cref_cont, pred_t(1)) );
|
BOOST_CHECK_EQUAL( 1u, boost::count_if(cref_cont, pred_t(1)) );
|
||||||
|
BOOST_CHECK_EQUAL( 1u, boost::count_if(boost::make_iterator_range(cont), pred_t(1)) );
|
||||||
BOOST_CHECK_EQUAL( 2u, boost::count_if(cont, pred_t(2)) );
|
BOOST_CHECK_EQUAL( 2u, boost::count_if(cont, pred_t(2)) );
|
||||||
BOOST_CHECK_EQUAL( 2u, boost::count_if(cref_cont, pred_t(2)) );
|
BOOST_CHECK_EQUAL( 2u, boost::count_if(cref_cont, pred_t(2)) );
|
||||||
|
BOOST_CHECK_EQUAL( 2u, boost::count_if(boost::make_iterator_range(cont), pred_t(2)) );
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL( 0u, boost::count_if(cont, false_predicate()) );
|
BOOST_CHECK_EQUAL( 0u, boost::count_if(cont, false_predicate()) );
|
||||||
BOOST_CHECK_EQUAL( 0u, boost::count_if(cref_cont, false_predicate()) );
|
BOOST_CHECK_EQUAL( 0u, boost::count_if(cref_cont, false_predicate()) );
|
||||||
|
BOOST_CHECK_EQUAL( 0u, boost::count_if(boost::make_iterator_range(cont), false_predicate()) );
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL( cont.size(), boost::count_if(cont, true_predicate()) );
|
||||||
|
BOOST_CHECK_EQUAL( cont.size(), boost::count_if(cref_cont, true_predicate()) );
|
||||||
|
BOOST_CHECK_EQUAL( cont.size(), boost::count_if(boost::make_iterator_range(cont), true_predicate()) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_count_if()
|
void test_count_if()
|
||||||
|
@ -38,30 +38,70 @@ namespace boost
|
|||||||
Container2& cont2 = mcont2;
|
Container2& cont2 = mcont2;
|
||||||
|
|
||||||
BOOST_CHECK( boost::equal(cont1, cont2) );
|
BOOST_CHECK( boost::equal(cont1, cont2) );
|
||||||
|
BOOST_CHECK( boost::equal(boost::make_iterator_range(cont1), cont2) );
|
||||||
|
BOOST_CHECK( boost::equal(cont1, boost::make_iterator_range(cont2)) );
|
||||||
|
BOOST_CHECK( boost::equal(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2)) );
|
||||||
BOOST_CHECK( boost::equal(cont1, cont2, std::equal_to<int>()) );
|
BOOST_CHECK( boost::equal(cont1, cont2, std::equal_to<int>()) );
|
||||||
|
BOOST_CHECK( boost::equal(boost::make_iterator_range(cont1), cont2, std::equal_to<int>()) );
|
||||||
|
BOOST_CHECK( boost::equal(cont1, boost::make_iterator_range(cont2), std::equal_to<int>()) );
|
||||||
|
BOOST_CHECK( boost::equal(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2), std::equal_to<int>()) );
|
||||||
BOOST_CHECK( boost::equal(cont1, cont2, std::not_equal_to<int>()) );
|
BOOST_CHECK( boost::equal(cont1, cont2, std::not_equal_to<int>()) );
|
||||||
|
BOOST_CHECK( boost::equal(boost::make_iterator_range(cont1), cont2, std::not_equal_to<int>()) );
|
||||||
|
BOOST_CHECK( boost::equal(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2), std::not_equal_to<int>()) );
|
||||||
|
|
||||||
mcont1 += 1;
|
mcont1 += 1;
|
||||||
BOOST_CHECK( !boost::equal(cont1, cont2) );
|
BOOST_CHECK( !boost::equal(cont1, cont2) );
|
||||||
|
BOOST_CHECK( !boost::equal(boost::make_iterator_range(cont1), cont2) );
|
||||||
|
BOOST_CHECK( !boost::equal(cont1, boost::make_iterator_range(cont2)) );
|
||||||
|
BOOST_CHECK( !boost::equal(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2)) );
|
||||||
BOOST_CHECK( !boost::equal(cont1, cont2, std::equal_to<int>()) );
|
BOOST_CHECK( !boost::equal(cont1, cont2, std::equal_to<int>()) );
|
||||||
|
BOOST_CHECK( !boost::equal(boost::make_iterator_range(cont1), cont2, std::equal_to<int>()) );
|
||||||
|
BOOST_CHECK( !boost::equal(cont1, boost::make_iterator_range(cont2), std::equal_to<int>()) );
|
||||||
|
BOOST_CHECK( !boost::equal(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2), std::equal_to<int>()) );
|
||||||
BOOST_CHECK( !boost::equal(cont1, cont2, std::not_equal_to<int>()) );
|
BOOST_CHECK( !boost::equal(cont1, cont2, std::not_equal_to<int>()) );
|
||||||
|
BOOST_CHECK( !boost::equal(boost::make_iterator_range(cont1), cont2, std::not_equal_to<int>()) );
|
||||||
|
BOOST_CHECK( !boost::equal(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2), std::not_equal_to<int>()) );
|
||||||
|
|
||||||
mcont1.clear();
|
mcont1.clear();
|
||||||
mcont2 += 1;
|
mcont2 += 1;
|
||||||
BOOST_CHECK( !boost::equal(cont1, cont2) );
|
BOOST_CHECK( !boost::equal(cont1, cont2) );
|
||||||
|
BOOST_CHECK( !boost::equal(boost::make_iterator_range(cont1), cont2) );
|
||||||
|
BOOST_CHECK( !boost::equal(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2)) );
|
||||||
BOOST_CHECK( !boost::equal(cont1, cont2, std::equal_to<int>()) );
|
BOOST_CHECK( !boost::equal(cont1, cont2, std::equal_to<int>()) );
|
||||||
|
BOOST_CHECK( !boost::equal(boost::make_iterator_range(cont1), cont2, std::equal_to<int>()) );
|
||||||
|
BOOST_CHECK( !boost::equal(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2), std::equal_to<int>()) );
|
||||||
BOOST_CHECK( !boost::equal(cont1, cont2, std::not_equal_to<int>()) );
|
BOOST_CHECK( !boost::equal(cont1, cont2, std::not_equal_to<int>()) );
|
||||||
|
BOOST_CHECK( !boost::equal(boost::make_iterator_range(cont1), cont2, std::not_equal_to<int>()) );
|
||||||
|
BOOST_CHECK( !boost::equal(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2), std::not_equal_to<int>()) );
|
||||||
|
|
||||||
mcont1 += 1;
|
mcont1 += 1;
|
||||||
BOOST_CHECK( boost::equal(cont1, cont2) );
|
BOOST_CHECK( boost::equal(cont1, cont2) );
|
||||||
|
BOOST_CHECK( boost::equal(boost::make_iterator_range(cont1), cont2) );
|
||||||
|
BOOST_CHECK( boost::equal(cont1, boost::make_iterator_range(cont2)) );
|
||||||
|
BOOST_CHECK( boost::equal(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2)) );
|
||||||
BOOST_CHECK( boost::equal(cont1, cont2, std::equal_to<int>()) );
|
BOOST_CHECK( boost::equal(cont1, cont2, std::equal_to<int>()) );
|
||||||
|
BOOST_CHECK( boost::equal(boost::make_iterator_range(cont1), cont2, std::equal_to<int>()) );
|
||||||
|
BOOST_CHECK( boost::equal(cont1, boost::make_iterator_range(cont2), std::equal_to<int>()) );
|
||||||
|
BOOST_CHECK( boost::equal(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2), std::equal_to<int>()) );
|
||||||
BOOST_CHECK( !boost::equal(cont1, cont2, std::not_equal_to<int>()) );
|
BOOST_CHECK( !boost::equal(cont1, cont2, std::not_equal_to<int>()) );
|
||||||
|
BOOST_CHECK( !boost::equal(boost::make_iterator_range(cont1), cont2, std::not_equal_to<int>()) );
|
||||||
|
BOOST_CHECK( !boost::equal(cont1, boost::make_iterator_range(cont2), std::not_equal_to<int>()) );
|
||||||
|
BOOST_CHECK( !boost::equal(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2), std::not_equal_to<int>()) );
|
||||||
|
|
||||||
mcont1 += 2,3,4,5,6,7,8,9;
|
mcont1 += 2,3,4,5,6,7,8,9;
|
||||||
mcont2 += 2,3,4,5,6,7,8,9;
|
mcont2 += 2,3,4,5,6,7,8,9;
|
||||||
BOOST_CHECK( boost::equal(cont1, cont2) );
|
BOOST_CHECK( boost::equal(cont1, cont2) );
|
||||||
|
BOOST_CHECK( boost::equal(boost::make_iterator_range(cont1), cont2) );
|
||||||
|
BOOST_CHECK( boost::equal(cont1, boost::make_iterator_range(cont2)) );
|
||||||
|
BOOST_CHECK( boost::equal(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2)) );
|
||||||
BOOST_CHECK( boost::equal(cont1, cont2, std::equal_to<int>()) );
|
BOOST_CHECK( boost::equal(cont1, cont2, std::equal_to<int>()) );
|
||||||
|
BOOST_CHECK( boost::equal(boost::make_iterator_range(cont1), cont2, std::equal_to<int>()) );
|
||||||
|
BOOST_CHECK( boost::equal(cont1, boost::make_iterator_range(cont2), std::equal_to<int>()) );
|
||||||
|
BOOST_CHECK( boost::equal(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2), std::equal_to<int>()) );
|
||||||
BOOST_CHECK( !boost::equal(cont1, cont2, std::not_equal_to<int>()) );
|
BOOST_CHECK( !boost::equal(cont1, cont2, std::not_equal_to<int>()) );
|
||||||
|
BOOST_CHECK( !boost::equal(boost::make_iterator_range(cont1), cont2, std::not_equal_to<int>()) );
|
||||||
|
BOOST_CHECK( !boost::equal(cont1, boost::make_iterator_range(cont2), std::not_equal_to<int>()) );
|
||||||
|
BOOST_CHECK( !boost::equal(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2), std::not_equal_to<int>()) );
|
||||||
}
|
}
|
||||||
|
|
||||||
template< class Container1, class Container2 >
|
template< class Container1, class Container2 >
|
||||||
|
@ -70,8 +70,11 @@ namespace boost
|
|||||||
|
|
||||||
pair_t test_result = boost::equal_range(test, 5);
|
pair_t test_result = boost::equal_range(test, 5);
|
||||||
|
|
||||||
check_result(reference, reference_result,
|
check_result(reference, reference_result, test, test_result);
|
||||||
test, test_result);
|
|
||||||
|
pair_t test_result2 = boost::equal_range(boost::make_iterator_range(test), 5);
|
||||||
|
|
||||||
|
check_result(reference, reference_result, test, test_result2);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container, class BinaryPredicate>
|
template<class Container, class BinaryPredicate>
|
||||||
@ -107,8 +110,11 @@ namespace boost
|
|||||||
|
|
||||||
pair_t test_result = boost::equal_range(test, 5, BinaryPredicate());
|
pair_t test_result = boost::equal_range(test, 5, BinaryPredicate());
|
||||||
|
|
||||||
check_result(reference, reference_result,
|
check_result(reference, reference_result, test, test_result);
|
||||||
test, test_result);
|
|
||||||
|
pair_t test_result2 = boost::equal_range(boost::make_iterator_range(test), 5, BinaryPredicate());
|
||||||
|
|
||||||
|
check_result(reference, reference_result, test, test_result2);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container>
|
template<class Container>
|
||||||
|
@ -36,6 +36,12 @@ namespace boost
|
|||||||
|
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
target.begin(), target.end() );
|
target.begin(), target.end() );
|
||||||
|
|
||||||
|
Container target2(cont);
|
||||||
|
boost::fill(boost::make_iterator_range(target2), 1);
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
|
target2.begin(), target2.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
template< class Container >
|
template< class Container >
|
||||||
|
@ -33,7 +33,11 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
test_iter(Container& cont)
|
||||||
{
|
{
|
||||||
return boost::find(cont, 3);
|
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>::type iter_t;
|
||||||
|
iter_t result = boost::find(cont, 3);
|
||||||
|
iter_t result2 = boost::find(boost::make_iterator_range(cont), 3);
|
||||||
|
BOOST_CHECK( result == result2 );
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<range_return_value return_type>
|
template<range_return_value return_type>
|
||||||
@ -43,7 +47,11 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
||||||
operator()(Policy&, Container& cont)
|
operator()(Policy&, Container& cont)
|
||||||
{
|
{
|
||||||
return boost::find<return_type>(cont, 3);
|
typedef BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type result_t;
|
||||||
|
result_t result = boost::find<return_type>(cont, 3);
|
||||||
|
result_t result2 = boost::find<return_type>(boost::make_iterator_range(cont), 3);
|
||||||
|
BOOST_CHECK( result == result2 );
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -90,6 +98,8 @@ namespace boost
|
|||||||
std::vector<int> vi;
|
std::vector<int> vi;
|
||||||
const std::vector<int>& cvi = vi;
|
const std::vector<int>& cvi = vi;
|
||||||
std::vector<int>::const_iterator it = boost::find(vi, 0);
|
std::vector<int>::const_iterator it = boost::find(vi, 0);
|
||||||
|
std::vector<int>::const_iterator it2 = boost::find(cvi, 0);
|
||||||
|
BOOST_CHECK( it == it2 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,12 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
test_iter(Container& cont)
|
||||||
{
|
{
|
||||||
return boost::find_end(cont, m_cont);
|
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>::type iter_t;
|
||||||
|
iter_t result = boost::find_end(cont, m_cont);
|
||||||
|
BOOST_CHECK( result == boost::find_end(boost::make_iterator_range(cont), m_cont) );
|
||||||
|
BOOST_CHECK( result == boost::find_end(cont, boost::make_iterator_range(m_cont)) );
|
||||||
|
BOOST_CHECK( result == boost::find_end(boost::make_iterator_range(cont), boost::make_iterator_range(m_cont)) );
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<range_return_value return_type>
|
template<range_return_value return_type>
|
||||||
@ -51,7 +56,13 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
||||||
operator()(Policy& policy, Container& cont)
|
operator()(Policy& policy, Container& cont)
|
||||||
{
|
{
|
||||||
return boost::find_end<return_type>(cont, policy.cont());
|
typedef BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type result_t;
|
||||||
|
result_t result = boost::find_end<return_type>(cont, policy.cont());
|
||||||
|
BOOST_CHECK( result == boost::find_end<return_type>(boost::make_iterator_range(cont), policy.cont()) );
|
||||||
|
BOOST_CHECK( result == boost::find_end<return_type>(cont, boost::make_iterator_range(policy.cont())) );
|
||||||
|
BOOST_CHECK( result == boost::find_end<return_type>(boost::make_iterator_range(cont),
|
||||||
|
boost::make_iterator_range(policy.cont())) );
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -84,7 +95,12 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
test_iter(Container& cont)
|
||||||
{
|
{
|
||||||
return boost::find_end(cont, m_cont, m_pred);
|
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>::type iter_t;
|
||||||
|
iter_t it = boost::find_end(cont, m_cont, m_pred);
|
||||||
|
BOOST_CHECK( it == boost::find_end(boost::make_iterator_range(cont), m_cont, m_pred) );
|
||||||
|
BOOST_CHECK( it == boost::find_end(cont, boost::make_iterator_range(m_cont), m_pred) );
|
||||||
|
BOOST_CHECK( it == boost::find_end(boost::make_iterator_range(cont), boost::make_iterator_range(m_cont), m_pred) );
|
||||||
|
return it;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<range_return_value return_type>
|
template<range_return_value return_type>
|
||||||
@ -94,6 +110,12 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
||||||
operator()(Policy& policy, Container& cont)
|
operator()(Policy& policy, Container& cont)
|
||||||
{
|
{
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type result_t;
|
||||||
|
result_t result = boost::find_end<return_type>(cont, policy.cont(), policy.pred());
|
||||||
|
BOOST_CHECK( result == boost::find_end<return_type>(boost::make_iterator_range(cont), policy.cont(), policy.pred()) );
|
||||||
|
BOOST_CHECK( result == boost::find_end<return_type>(cont, boost::make_iterator_range(policy.cont()), policy.pred()) );
|
||||||
|
BOOST_CHECK( result == boost::find_end<return_type>(boost::make_iterator_range(cont),
|
||||||
|
boost::make_iterator_range(policy.cont()), policy.pred()) );
|
||||||
return boost::find_end<return_type>(cont, policy.cont(), policy.pred());
|
return boost::find_end<return_type>(cont, policy.cont(), policy.pred());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -41,7 +41,12 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
test_iter(Container& cont)
|
||||||
{
|
{
|
||||||
return boost::find_first_of(cont, m_cont);
|
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>::type iter_t;
|
||||||
|
iter_t result = boost::find_first_of(cont, m_cont);
|
||||||
|
BOOST_CHECK( result == boost::find_first_of(boost::make_iterator_range(cont), m_cont) );
|
||||||
|
BOOST_CHECK( result == boost::find_first_of(cont, boost::make_iterator_range(m_cont)) );
|
||||||
|
BOOST_CHECK( result == boost::find_first_of(boost::make_iterator_range(cont), boost::make_iterator_range(m_cont)) );
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<range_return_value return_type>
|
template<range_return_value return_type>
|
||||||
@ -51,7 +56,12 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
||||||
operator()(Policy& policy, Container& cont)
|
operator()(Policy& policy, Container& cont)
|
||||||
{
|
{
|
||||||
return boost::find_first_of<return_type>(cont, policy.cont());
|
typedef BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type result_t;
|
||||||
|
result_t result = boost::find_first_of<return_type>(cont, policy.cont());
|
||||||
|
BOOST_CHECK( result == boost::find_first_of<return_type>(boost::make_iterator_range(cont), policy.cont()) );
|
||||||
|
BOOST_CHECK( result == boost::find_first_of<return_type>(cont, boost::make_iterator_range(policy.cont())) );
|
||||||
|
BOOST_CHECK( result == boost::find_first_of<return_type>(boost::make_iterator_range(cont), boost::make_iterator_range(policy.cont())) );
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -84,7 +94,12 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
test_iter(Container& cont)
|
||||||
{
|
{
|
||||||
return boost::find_first_of(cont, m_cont, m_pred);
|
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>::type iter_t;
|
||||||
|
iter_t result = boost::find_first_of(cont, m_cont, m_pred);
|
||||||
|
BOOST_CHECK( result == boost::find_first_of(boost::make_iterator_range(cont), m_cont, m_pred) );
|
||||||
|
BOOST_CHECK( result == boost::find_first_of(cont, boost::make_iterator_range(m_cont), m_pred) );
|
||||||
|
BOOST_CHECK( result == boost::find_first_of(boost::make_iterator_range(cont), boost::make_iterator_range(m_cont), m_pred) );
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<range_return_value return_type>
|
template<range_return_value return_type>
|
||||||
@ -94,7 +109,12 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
||||||
operator()(Policy& policy, Container& cont)
|
operator()(Policy& policy, Container& cont)
|
||||||
{
|
{
|
||||||
return boost::find_first_of<return_type>(cont, policy.cont(), policy.pred());
|
typedef BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type result_t;
|
||||||
|
result_t result = boost::find_first_of<return_type>(cont, policy.cont(), policy.pred());
|
||||||
|
BOOST_CHECK( result == boost::find_first_of<return_type>(boost::make_iterator_range(cont), policy.cont(), policy.pred()) );
|
||||||
|
BOOST_CHECK( result == boost::find_first_of<return_type>(cont, boost::make_iterator_range(policy.cont()), policy.pred()) );
|
||||||
|
BOOST_CHECK( result == boost::find_first_of<return_type>(boost::make_iterator_range(cont), boost::make_iterator_range(policy.cont()), policy.pred()) );
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -38,7 +38,10 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
test_iter(Container& cont)
|
||||||
{
|
{
|
||||||
return boost::find_if(cont, m_pred);
|
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>::type iter_t;
|
||||||
|
iter_t result = boost::find_if(cont, m_pred);
|
||||||
|
BOOST_CHECK( result == boost::find_if(boost::make_iterator_range(cont), m_pred) );
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<range_return_value return_type>
|
template<range_return_value return_type>
|
||||||
@ -48,7 +51,10 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
||||||
operator()(find_if_test_policy& policy, Container& cont)
|
operator()(find_if_test_policy& policy, Container& cont)
|
||||||
{
|
{
|
||||||
return boost::find_if<return_type>(cont, policy.pred());
|
typedef BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type result_t;
|
||||||
|
result_t result = boost::find_if<return_type>(cont, policy.pred());
|
||||||
|
BOOST_CHECK( result == boost::find_if<return_type>(boost::make_iterator_range(cont), policy.pred()) );
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -43,6 +43,9 @@ namespace boost
|
|||||||
fn_t result_fn = boost::for_each(rng, fn_t(rng));
|
fn_t result_fn = boost::for_each(rng, fn_t(rng));
|
||||||
BOOST_CHECK_EQUAL( boost::udistance(rng), result_fn.invocation_count() );
|
BOOST_CHECK_EQUAL( boost::udistance(rng), result_fn.invocation_count() );
|
||||||
|
|
||||||
|
fn_t result_fn2 = boost::for_each(boost::make_iterator_range(rng), fn_t(rng));
|
||||||
|
BOOST_CHECK_EQUAL( boost::udistance(rng), result_fn.invocation_count() );
|
||||||
|
|
||||||
// Test the constant version
|
// Test the constant version
|
||||||
const SinglePassRange& cref_rng = rng;
|
const SinglePassRange& cref_rng = rng;
|
||||||
result_fn = boost::for_each(cref_rng, fn_t(cref_rng));
|
result_fn = boost::for_each(cref_rng, fn_t(cref_rng));
|
||||||
|
@ -49,6 +49,12 @@ namespace boost
|
|||||||
|
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
test.begin(), test.end() );
|
test.begin(), test.end() );
|
||||||
|
|
||||||
|
Container test2(cont);
|
||||||
|
boost::generate(boost::make_iterator_range(test2), generator_fn());
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
|
test2.begin(), test2.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
template< class Container >
|
template< class Container >
|
||||||
|
@ -41,28 +41,39 @@ namespace boost
|
|||||||
reference += 1,2,3,4,5,6,7,8,9;
|
reference += 1,2,3,4,5,6,7,8,9;
|
||||||
|
|
||||||
std::vector<int> test_cont(reference);
|
std::vector<int> test_cont(reference);
|
||||||
|
std::vector<int> test_cont2(reference);
|
||||||
|
|
||||||
std::make_heap(reference.begin(), reference.end());
|
std::make_heap(reference.begin(), reference.end());
|
||||||
boost::make_heap(test_cont);
|
boost::make_heap(test_cont);
|
||||||
check_equal(reference, test_cont);
|
check_equal(reference, test_cont);
|
||||||
|
boost::make_heap(boost::make_iterator_range(test_cont2));
|
||||||
|
check_equal(reference, test_cont2);
|
||||||
|
|
||||||
std::push_heap(reference.begin(), reference.end());
|
std::push_heap(reference.begin(), reference.end());
|
||||||
boost::push_heap(test_cont);
|
boost::push_heap(test_cont);
|
||||||
check_equal(reference, test_cont);
|
check_equal(reference, test_cont);
|
||||||
|
boost::push_heap(boost::make_iterator_range(test_cont2));
|
||||||
|
check_equal(reference, test_cont2);
|
||||||
|
|
||||||
std::make_heap(reference.begin(), reference.end());
|
std::make_heap(reference.begin(), reference.end());
|
||||||
boost::make_heap(test_cont);
|
boost::make_heap(test_cont);
|
||||||
|
boost::make_heap(boost::make_iterator_range(test_cont2));
|
||||||
|
|
||||||
std::sort_heap(reference.begin(), reference.end());
|
std::sort_heap(reference.begin(), reference.end());
|
||||||
boost::sort_heap(test_cont);
|
boost::sort_heap(test_cont);
|
||||||
check_equal(reference, test_cont);
|
check_equal(reference, test_cont);
|
||||||
|
boost::sort_heap(boost::make_iterator_range(test_cont2));
|
||||||
|
check_equal(reference, test_cont2);
|
||||||
|
|
||||||
std::make_heap(reference.begin(), reference.end());
|
std::make_heap(reference.begin(), reference.end());
|
||||||
boost::make_heap(test_cont);
|
boost::make_heap(test_cont);
|
||||||
|
boost::make_heap(boost::make_iterator_range(test_cont2));
|
||||||
|
|
||||||
std::pop_heap(reference.begin(), reference.end());
|
std::pop_heap(reference.begin(), reference.end());
|
||||||
boost::pop_heap(test_cont);
|
boost::pop_heap(test_cont);
|
||||||
check_equal(reference, test_cont);
|
check_equal(reference, test_cont);
|
||||||
|
boost::pop_heap(boost::make_iterator_range(test_cont2));
|
||||||
|
check_equal(reference, test_cont2);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class BinaryPredicate>
|
template<class BinaryPredicate>
|
||||||
@ -75,30 +86,42 @@ namespace boost
|
|||||||
std::sort(reference.begin(), reference.end(), pred);
|
std::sort(reference.begin(), reference.end(), pred);
|
||||||
|
|
||||||
std::vector<int> test_cont(reference);
|
std::vector<int> test_cont(reference);
|
||||||
|
std::vector<int> test_cont2(reference);
|
||||||
|
|
||||||
std::make_heap(reference.begin(), reference.end(), pred);
|
std::make_heap(reference.begin(), reference.end(), pred);
|
||||||
boost::make_heap(test_cont, pred);
|
boost::make_heap(test_cont, pred);
|
||||||
check_equal(reference, test_cont);
|
check_equal(reference, test_cont);
|
||||||
|
boost::make_heap(boost::make_iterator_range(test_cont2), pred);
|
||||||
|
check_equal(reference, test_cont2);
|
||||||
|
|
||||||
reference.push_back(5);
|
reference.push_back(5);
|
||||||
test_cont.push_back(5);
|
test_cont.push_back(5);
|
||||||
|
test_cont2.push_back(5);
|
||||||
std::push_heap(reference.begin(), reference.end(), pred);
|
std::push_heap(reference.begin(), reference.end(), pred);
|
||||||
boost::push_heap(test_cont, pred);
|
boost::push_heap(test_cont, pred);
|
||||||
check_equal(reference, test_cont);
|
check_equal(reference, test_cont);
|
||||||
|
boost::push_heap(boost::make_iterator_range(test_cont2), pred);
|
||||||
|
check_equal(reference, test_cont2);
|
||||||
|
|
||||||
std::make_heap(reference.begin(), reference.end(), pred);
|
std::make_heap(reference.begin(), reference.end(), pred);
|
||||||
boost::make_heap(test_cont, pred);
|
boost::make_heap(test_cont, pred);
|
||||||
|
boost::make_heap(boost::make_iterator_range(test_cont2), pred);
|
||||||
|
|
||||||
std::sort_heap(reference.begin(), reference.end(), pred);
|
std::sort_heap(reference.begin(), reference.end(), pred);
|
||||||
boost::sort_heap(test_cont, pred);
|
boost::sort_heap(test_cont, pred);
|
||||||
check_equal(reference, test_cont);
|
check_equal(reference, test_cont);
|
||||||
|
boost::sort_heap(boost::make_iterator_range(test_cont2), pred);
|
||||||
|
check_equal(reference, test_cont2);
|
||||||
|
|
||||||
std::make_heap(reference.begin(), reference.end(), pred);
|
std::make_heap(reference.begin(), reference.end(), pred);
|
||||||
boost::make_heap(test_cont, pred);
|
boost::make_heap(test_cont, pred);
|
||||||
|
boost::make_heap(boost::make_iterator_range(test_cont2), pred);
|
||||||
|
|
||||||
std::pop_heap(reference.begin(), reference.end(), pred);
|
std::pop_heap(reference.begin(), reference.end(), pred);
|
||||||
boost::pop_heap(test_cont, pred);
|
boost::pop_heap(test_cont, pred);
|
||||||
check_equal(reference, test_cont);
|
check_equal(reference, test_cont);
|
||||||
|
boost::pop_heap(boost::make_iterator_range(test_cont2), pred);
|
||||||
|
check_equal(reference, test_cont2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_heap()
|
void test_heap()
|
||||||
|
@ -46,6 +46,10 @@ namespace boost
|
|||||||
old_cont2.begin(), old_cont2.end(),
|
old_cont2.begin(), old_cont2.end(),
|
||||||
cont2.begin(), cont2.end()
|
cont2.begin(), cont2.end()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
BOOST_CHECK( test_result == boost::includes(boost::make_iterator_range(cont1), cont2) );
|
||||||
|
BOOST_CHECK( test_result == boost::includes(cont1, boost::make_iterator_range(cont2)) );
|
||||||
|
BOOST_CHECK( test_result == boost::includes(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2)) );
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container, class BinaryPredicate>
|
template<class Container, class BinaryPredicate>
|
||||||
@ -88,6 +92,10 @@ namespace boost
|
|||||||
old_cont2.begin(), old_cont2.end(),
|
old_cont2.begin(), old_cont2.end(),
|
||||||
cont2.begin(), cont2.end()
|
cont2.begin(), cont2.end()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
BOOST_CHECK( test_result == boost::includes(boost::make_iterator_range(cont1), cont2, pred) );
|
||||||
|
BOOST_CHECK( test_result == boost::includes(cont1, boost::make_iterator_range(cont2), pred) );
|
||||||
|
BOOST_CHECK( test_result == boost::includes(boost::make_iterator_range(cont1), boost::make_iterator_range(cont2), pred) );
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container1, class Container2>
|
template<class Container1, class Container2>
|
||||||
|
@ -35,6 +35,7 @@ namespace boost
|
|||||||
cont2.begin(), cont2.end());
|
cont2.begin(), cont2.end());
|
||||||
|
|
||||||
std::vector<value_t> test_target(reference_target);
|
std::vector<value_t> test_target(reference_target);
|
||||||
|
std::vector<value_t> test_target2(reference_target);
|
||||||
|
|
||||||
std::inplace_merge(reference_target.begin(),
|
std::inplace_merge(reference_target.begin(),
|
||||||
reference_target.begin() + cont1.size(),
|
reference_target.begin() + cont1.size(),
|
||||||
@ -47,6 +48,14 @@ namespace boost
|
|||||||
reference_target.begin(), reference_target.end(),
|
reference_target.begin(), reference_target.end(),
|
||||||
test_target.begin(), test_target.end()
|
test_target.begin(), test_target.end()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
boost::inplace_merge(boost::make_iterator_range(test_target2),
|
||||||
|
test_target2.begin() + cont1.size());
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS(
|
||||||
|
reference_target.begin(), reference_target.end(),
|
||||||
|
test_target2.begin(), test_target2.end()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container, class BinaryPredicate>
|
template<class Container, class BinaryPredicate>
|
||||||
@ -75,6 +84,7 @@ namespace boost
|
|||||||
cont2.begin(), cont2.end());
|
cont2.begin(), cont2.end());
|
||||||
|
|
||||||
std::vector<value_t> test_target(reference_target);
|
std::vector<value_t> test_target(reference_target);
|
||||||
|
std::vector<value_t> test_target2(reference_target);
|
||||||
|
|
||||||
std::inplace_merge(reference_target.begin(),
|
std::inplace_merge(reference_target.begin(),
|
||||||
reference_target.begin() + cont1.size(),
|
reference_target.begin() + cont1.size(),
|
||||||
@ -88,6 +98,15 @@ namespace boost
|
|||||||
reference_target.begin(), reference_target.end(),
|
reference_target.begin(), reference_target.end(),
|
||||||
test_target.begin(), test_target.end()
|
test_target.begin(), test_target.end()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
boost::inplace_merge(boost::make_iterator_range(test_target2),
|
||||||
|
test_target2.begin() + cont1.size(),
|
||||||
|
pred);
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS(
|
||||||
|
reference_target.begin(), reference_target.end(),
|
||||||
|
test_target2.begin(), test_target2.end()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container1, class Container2>
|
template<class Container1, class Container2>
|
||||||
|
@ -28,13 +28,16 @@ namespace boost
|
|||||||
void test_lexicographical_compare_impl_nopred(ForwardRange1& rng1,
|
void test_lexicographical_compare_impl_nopred(ForwardRange1& rng1,
|
||||||
ForwardRange2& rng2)
|
ForwardRange2& rng2)
|
||||||
{
|
{
|
||||||
bool reference = std::lexicographical_compare(
|
const bool reference = std::lexicographical_compare(
|
||||||
boost::begin(rng1), boost::end(rng1),
|
boost::begin(rng1), boost::end(rng1),
|
||||||
boost::begin(rng2), boost::end(rng2));
|
boost::begin(rng2), boost::end(rng2));
|
||||||
|
|
||||||
bool test = boost::lexicographical_compare(rng1, rng2);
|
const bool test = boost::lexicographical_compare(rng1, rng2);
|
||||||
|
|
||||||
BOOST_CHECK( reference == test );
|
BOOST_CHECK( reference == test );
|
||||||
|
BOOST_CHECK( test == boost::lexicographical_compare(boost::make_iterator_range(rng1), rng2) );
|
||||||
|
BOOST_CHECK( test == boost::lexicographical_compare(rng1, boost::make_iterator_range(rng2)) );
|
||||||
|
BOOST_CHECK( test == boost::lexicographical_compare(boost::make_iterator_range(rng1), boost::make_iterator_range(rng2)) );
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class ForwardRange1, class ForwardRange2,
|
template<class ForwardRange1, class ForwardRange2,
|
||||||
@ -43,14 +46,17 @@ namespace boost
|
|||||||
ForwardRange2& rng2,
|
ForwardRange2& rng2,
|
||||||
BinaryPredicate pred)
|
BinaryPredicate pred)
|
||||||
{
|
{
|
||||||
bool reference = std::lexicographical_compare(
|
const bool reference = std::lexicographical_compare(
|
||||||
boost::begin(rng1), boost::end(rng1),
|
boost::begin(rng1), boost::end(rng1),
|
||||||
boost::begin(rng2), boost::end(rng2),
|
boost::begin(rng2), boost::end(rng2),
|
||||||
pred);
|
pred);
|
||||||
|
|
||||||
bool test = boost::lexicographical_compare(rng1, rng2, pred);
|
const bool test = boost::lexicographical_compare(rng1, rng2, pred);
|
||||||
|
|
||||||
BOOST_CHECK( reference == test );
|
BOOST_CHECK( reference == test );
|
||||||
|
BOOST_CHECK( test == boost::lexicographical_compare(boost::make_iterator_range(rng1), rng2, pred) );
|
||||||
|
BOOST_CHECK( test == boost::lexicographical_compare(rng1, boost::make_iterator_range(rng2), pred) );
|
||||||
|
BOOST_CHECK( test == boost::lexicographical_compare(boost::make_iterator_range(rng1), boost::make_iterator_range(rng2), pred) );
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container1, class Container2>
|
template<class Container1, class Container2>
|
||||||
|
@ -33,7 +33,10 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
test_iter(Container& cont)
|
||||||
{
|
{
|
||||||
return boost::lower_bound(cont, 5);
|
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>::type iter_t;
|
||||||
|
iter_t result = boost::lower_bound(cont, 5);
|
||||||
|
BOOST_CHECK( result == boost::lower_bound(boost::make_iterator_range(cont), 5) );
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<range_return_value return_type>
|
template<range_return_value return_type>
|
||||||
@ -43,7 +46,10 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
||||||
operator()(Policy&, Container& cont)
|
operator()(Policy&, Container& cont)
|
||||||
{
|
{
|
||||||
return boost::lower_bound<return_type>(cont, 5);
|
typedef BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type result_t;
|
||||||
|
result_t result = boost::lower_bound<return_type>(cont, 5);
|
||||||
|
BOOST_CHECK( result == boost::lower_bound<return_type>(boost::make_iterator_range(cont), 5) );
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -62,7 +68,11 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
test_iter(Container& cont)
|
||||||
{
|
{
|
||||||
return boost::lower_bound(cont, 5, m_pred);
|
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>::type iter_t;
|
||||||
|
iter_t result = boost::lower_bound(cont, 5, m_pred);
|
||||||
|
BOOST_CHECK( result == boost::lower_bound(
|
||||||
|
boost::make_iterator_range(cont), 5, m_pred) );
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template< range_return_value return_type >
|
template< range_return_value return_type >
|
||||||
@ -72,8 +82,11 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
||||||
operator()(Policy& policy, Container& cont)
|
operator()(Policy& policy, Container& cont)
|
||||||
{
|
{
|
||||||
return boost::lower_bound<return_type>(
|
typedef BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type result_t;
|
||||||
cont, 5, policy.pred());
|
result_t result = boost::lower_bound<return_type>(cont, 5, policy.pred());
|
||||||
|
BOOST_CHECK( result == boost::lower_bound<return_type>(
|
||||||
|
boost::make_iterator_range(cont), 5, policy.pred()) );
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -33,7 +33,11 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
test_iter(Container& cont)
|
||||||
{
|
{
|
||||||
return boost::max_element(cont);
|
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>::type iter_t;
|
||||||
|
iter_t result = boost::max_element(cont);
|
||||||
|
BOOST_CHECK( result == boost::max_element(
|
||||||
|
boost::make_iterator_range(cont)) );
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<range_return_value return_type>
|
template<range_return_value return_type>
|
||||||
@ -43,7 +47,11 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
||||||
operator()(Policy&, Container& cont)
|
operator()(Policy&, Container& cont)
|
||||||
{
|
{
|
||||||
return boost::max_element<return_type>(cont);
|
typedef BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type result_t;
|
||||||
|
result_t result = boost::max_element<return_type>(cont);
|
||||||
|
BOOST_CHECK( result == boost::max_element<return_type>(
|
||||||
|
boost::make_iterator_range(cont)) );
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -63,7 +71,11 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
test_iter(Container& cont)
|
||||||
{
|
{
|
||||||
return boost::max_element(cont, Pred());
|
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>::type iter_t;
|
||||||
|
iter_t result = boost::max_element(cont, Pred());
|
||||||
|
BOOST_CHECK( result == boost::max_element(
|
||||||
|
boost::make_iterator_range(cont), Pred()) );
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pred pred() const { return Pred(); }
|
Pred pred() const { return Pred(); }
|
||||||
@ -75,7 +87,11 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
||||||
operator()(Policy& policy, Container& cont)
|
operator()(Policy& policy, Container& cont)
|
||||||
{
|
{
|
||||||
return boost::max_element<return_type>(cont, policy.pred());
|
typedef BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type result_t;
|
||||||
|
result_t result = boost::max_element<return_type>(cont, policy.pred());
|
||||||
|
BOOST_CHECK( result == boost::max_element<return_type>(
|
||||||
|
boost::make_iterator_range(cont), policy.pred()) );
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -51,6 +51,46 @@ namespace boost
|
|||||||
reference_target.begin(), reference_target.end(),
|
reference_target.begin(), reference_target.end(),
|
||||||
test_target.begin(), test_target.end()
|
test_target.begin(), test_target.end()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
test_it = boost::merge(boost::make_iterator_range(cont1),
|
||||||
|
cont2, test_target.begin());
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL(
|
||||||
|
std::distance<iterator_t>(reference_target.begin(), reference_it),
|
||||||
|
std::distance<iterator_t>(test_target.begin(), test_it)
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS(
|
||||||
|
reference_target.begin(), reference_target.end(),
|
||||||
|
test_target.begin(), test_target.end()
|
||||||
|
);
|
||||||
|
|
||||||
|
test_it = boost::merge(cont1, boost::make_iterator_range(cont2),
|
||||||
|
test_target.begin());
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL(
|
||||||
|
std::distance<iterator_t>(reference_target.begin(), reference_it),
|
||||||
|
std::distance<iterator_t>(test_target.begin(), test_it)
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS(
|
||||||
|
reference_target.begin(), reference_target.end(),
|
||||||
|
test_target.begin(), test_target.end()
|
||||||
|
);
|
||||||
|
|
||||||
|
test_it = boost::merge(boost::make_iterator_range(cont1),
|
||||||
|
boost::make_iterator_range(cont2),
|
||||||
|
test_target.begin());
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL(
|
||||||
|
std::distance<iterator_t>(reference_target.begin(), reference_it),
|
||||||
|
std::distance<iterator_t>(test_target.begin(), test_it)
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS(
|
||||||
|
reference_target.begin(), reference_target.end(),
|
||||||
|
test_target.begin(), test_target.end()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container, class BinaryPredicate>
|
template<class Container, class BinaryPredicate>
|
||||||
@ -95,6 +135,46 @@ namespace boost
|
|||||||
reference_target.begin(), reference_target.end(),
|
reference_target.begin(), reference_target.end(),
|
||||||
test_target.begin(), test_target.end()
|
test_target.begin(), test_target.end()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
test_it = boost::merge(boost::make_iterator_range(cont1), cont2,
|
||||||
|
test_target.begin(), pred);
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL(
|
||||||
|
std::distance(reference_target.begin(), reference_it),
|
||||||
|
std::distance(test_target.begin(), test_it)
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS(
|
||||||
|
reference_target.begin(), reference_target.end(),
|
||||||
|
test_target.begin(), test_target.end()
|
||||||
|
);
|
||||||
|
|
||||||
|
test_it = boost::merge(cont1, boost::make_iterator_range(cont2),
|
||||||
|
test_target.begin(), pred);
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL(
|
||||||
|
std::distance(reference_target.begin(), reference_it),
|
||||||
|
std::distance(test_target.begin(), test_it)
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS(
|
||||||
|
reference_target.begin(), reference_target.end(),
|
||||||
|
test_target.begin(), test_target.end()
|
||||||
|
);
|
||||||
|
|
||||||
|
test_it = boost::merge(boost::make_iterator_range(cont1),
|
||||||
|
boost::make_iterator_range(cont2),
|
||||||
|
test_target.begin(), pred);
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL(
|
||||||
|
std::distance(reference_target.begin(), reference_it),
|
||||||
|
std::distance(test_target.begin(), test_it)
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS(
|
||||||
|
reference_target.begin(), reference_target.end(),
|
||||||
|
test_target.begin(), test_target.end()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container1, class Container2>
|
template<class Container1, class Container2>
|
||||||
|
@ -33,7 +33,10 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
test_iter(Container& cont)
|
||||||
{
|
{
|
||||||
return boost::min_element(cont);
|
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>::type iter_t;
|
||||||
|
iter_t result = boost::min_element(cont);
|
||||||
|
BOOST_CHECK( result == boost::min_element(boost::make_iterator_range(cont)) );
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template< range_return_value return_type >
|
template< range_return_value return_type >
|
||||||
@ -43,7 +46,10 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
||||||
operator()(Policy&, Container& cont)
|
operator()(Policy&, Container& cont)
|
||||||
{
|
{
|
||||||
return boost::min_element<return_type>(cont);
|
typedef BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type result_t;
|
||||||
|
result_t result = boost::min_element<return_type>(cont);
|
||||||
|
BOOST_CHECK( result == boost::min_element<return_type>(boost::make_iterator_range(cont)) );
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -63,7 +69,11 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
test_iter(Container& cont)
|
||||||
{
|
{
|
||||||
return boost::min_element(cont, Pred());
|
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>::type iter_t;
|
||||||
|
iter_t result = boost::min_element(cont, Pred());
|
||||||
|
BOOST_CHECK( result == boost::min_element(
|
||||||
|
boost::make_iterator_range(cont), Pred()) );
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pred pred() const { return Pred(); }
|
Pred pred() const { return Pred(); }
|
||||||
@ -75,7 +85,11 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
||||||
operator()(Policy& policy, Container& cont)
|
operator()(Policy& policy, Container& cont)
|
||||||
{
|
{
|
||||||
return boost::min_element<return_type>(cont, policy.pred());
|
typedef BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type result_t;
|
||||||
|
result_t result = boost::min_element<return_type>(cont, policy.pred());
|
||||||
|
BOOST_CHECK( result == boost::min_element<return_type>(
|
||||||
|
boost::make_iterator_range(cont), policy.pred()) );
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -23,6 +23,130 @@ namespace boost
|
|||||||
{
|
{
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
template< class Container1, class Container2 >
|
||||||
|
void eval_mismatch(Container1& cont1,
|
||||||
|
Container2& cont2,
|
||||||
|
BOOST_DEDUCED_TYPENAME range_iterator<Container1>::type ref_it1,
|
||||||
|
BOOST_DEDUCED_TYPENAME range_iterator<Container2>::type ref_it2
|
||||||
|
)
|
||||||
|
{
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container1>::type iter1_t;
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container2>::type iter2_t;
|
||||||
|
typedef std::pair<iter1_t, iter2_t> result_pair_t;
|
||||||
|
|
||||||
|
result_pair_t result = boost::mismatch(cont1, cont2);
|
||||||
|
BOOST_CHECK( result.first == ref_it1 );
|
||||||
|
BOOST_CHECK( result.second == ref_it2 );
|
||||||
|
|
||||||
|
result = boost::mismatch(boost::make_iterator_range(cont1),
|
||||||
|
cont2);
|
||||||
|
BOOST_CHECK( result.first == ref_it1 );
|
||||||
|
BOOST_CHECK( result.second == ref_it2 );
|
||||||
|
|
||||||
|
result = boost::mismatch(cont1,
|
||||||
|
boost::make_iterator_range(cont2));
|
||||||
|
BOOST_CHECK( result.first == ref_it1 );
|
||||||
|
BOOST_CHECK( result.second == ref_it2 );
|
||||||
|
|
||||||
|
result = boost::mismatch(boost::make_iterator_range(cont1),
|
||||||
|
boost::make_iterator_range(cont2));
|
||||||
|
BOOST_CHECK( result.first == ref_it1 );
|
||||||
|
BOOST_CHECK( result.second == ref_it2 );
|
||||||
|
}
|
||||||
|
|
||||||
|
template< class Container1, class Container2, class Pred >
|
||||||
|
void eval_mismatch(Container1& cont1,
|
||||||
|
Container2& cont2,
|
||||||
|
Pred pred,
|
||||||
|
BOOST_DEDUCED_TYPENAME range_iterator<Container1>::type ref_it1,
|
||||||
|
BOOST_DEDUCED_TYPENAME range_iterator<Container2>::type ref_it2
|
||||||
|
)
|
||||||
|
{
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container1>::type iter1_t;
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container2>::type iter2_t;
|
||||||
|
typedef std::pair<iter1_t, iter2_t> result_pair_t;
|
||||||
|
|
||||||
|
result_pair_t result = boost::mismatch(cont1, cont2, pred);
|
||||||
|
BOOST_CHECK( result.first == ref_it1 );
|
||||||
|
BOOST_CHECK( result.second == ref_it2 );
|
||||||
|
|
||||||
|
result = boost::mismatch(boost::make_iterator_range(cont1),
|
||||||
|
cont2, pred);
|
||||||
|
BOOST_CHECK( result.first == ref_it1 );
|
||||||
|
BOOST_CHECK( result.second == ref_it2 );
|
||||||
|
|
||||||
|
result = boost::mismatch(cont1,
|
||||||
|
boost::make_iterator_range(cont2), pred);
|
||||||
|
BOOST_CHECK( result.first == ref_it1 );
|
||||||
|
BOOST_CHECK( result.second == ref_it2 );
|
||||||
|
|
||||||
|
result = boost::mismatch(boost::make_iterator_range(cont1),
|
||||||
|
boost::make_iterator_range(cont2),
|
||||||
|
pred);
|
||||||
|
BOOST_CHECK( result.first == ref_it1 );
|
||||||
|
BOOST_CHECK( result.second == ref_it2 );
|
||||||
|
}
|
||||||
|
|
||||||
|
template< class Container1, class Container2 >
|
||||||
|
void eval_mismatch(Container1& cont1,
|
||||||
|
Container2& cont2,
|
||||||
|
const int ref1,
|
||||||
|
const int ref2)
|
||||||
|
{
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container1>::type iter1_t;
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container2>::type iter2_t;
|
||||||
|
typedef std::pair<iter1_t, iter2_t> result_pair_t;
|
||||||
|
|
||||||
|
result_pair_t result = boost::mismatch(cont1, cont2);
|
||||||
|
BOOST_CHECK_EQUAL( ref1, *result.first );
|
||||||
|
BOOST_CHECK_EQUAL( ref2, *result.second );
|
||||||
|
|
||||||
|
result = boost::mismatch(boost::make_iterator_range(cont1), cont2);
|
||||||
|
BOOST_CHECK_EQUAL( ref1, *result.first );
|
||||||
|
BOOST_CHECK_EQUAL( ref2, *result.second );
|
||||||
|
|
||||||
|
result = boost::mismatch(cont1, boost::make_iterator_range(cont2));
|
||||||
|
BOOST_CHECK_EQUAL( ref1, *result.first );
|
||||||
|
BOOST_CHECK_EQUAL( ref2, *result.second );
|
||||||
|
|
||||||
|
result = boost::mismatch(boost::make_iterator_range(cont1),
|
||||||
|
boost::make_iterator_range(cont2));
|
||||||
|
BOOST_CHECK_EQUAL( ref1, *result.first );
|
||||||
|
BOOST_CHECK_EQUAL( ref2, *result.second );
|
||||||
|
}
|
||||||
|
|
||||||
|
template< class Container1, class Container2, class Pred >
|
||||||
|
void eval_mismatch(Container1& cont1,
|
||||||
|
Container2& cont2,
|
||||||
|
Pred pred,
|
||||||
|
const int ref1,
|
||||||
|
const int ref2)
|
||||||
|
{
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container1>::type iter1_t;
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container2>::type iter2_t;
|
||||||
|
typedef std::pair<iter1_t, iter2_t> result_pair_t;
|
||||||
|
|
||||||
|
result_pair_t result = boost::mismatch(cont1, cont2, pred);
|
||||||
|
BOOST_CHECK_EQUAL( ref1, *result.first );
|
||||||
|
BOOST_CHECK_EQUAL( ref2, *result.second );
|
||||||
|
|
||||||
|
result = boost::mismatch(boost::make_iterator_range(cont1),
|
||||||
|
cont2, pred);
|
||||||
|
BOOST_CHECK_EQUAL( ref1, *result.first );
|
||||||
|
BOOST_CHECK_EQUAL( ref2, *result.second );
|
||||||
|
|
||||||
|
result = boost::mismatch(cont1, boost::make_iterator_range(cont2),
|
||||||
|
pred);
|
||||||
|
BOOST_CHECK_EQUAL( ref1, *result.first );
|
||||||
|
BOOST_CHECK_EQUAL( ref2, *result.second );
|
||||||
|
|
||||||
|
result = boost::mismatch(boost::make_iterator_range(cont1),
|
||||||
|
boost::make_iterator_range(cont2),
|
||||||
|
pred);
|
||||||
|
BOOST_CHECK_EQUAL( ref1, *result.first );
|
||||||
|
BOOST_CHECK_EQUAL( ref2, *result.second );
|
||||||
|
}
|
||||||
|
|
||||||
template< class Container1, class Container2 >
|
template< class Container1, class Container2 >
|
||||||
void test_mismatch_impl()
|
void test_mismatch_impl()
|
||||||
{
|
{
|
||||||
@ -46,107 +170,42 @@ namespace boost
|
|||||||
typedef std::pair<iterator1_t, const_iterator2_t> pair_mcit_t;
|
typedef std::pair<iterator1_t, const_iterator2_t> pair_mcit_t;
|
||||||
typedef std::pair<const_iterator1_t, const_iterator2_t> pair_ccit_t;
|
typedef std::pair<const_iterator1_t, const_iterator2_t> pair_ccit_t;
|
||||||
|
|
||||||
pair_mmit_t pair_mmit = boost::mismatch(cont1, cont2);
|
eval_mismatch(cont1, cont2, cont1.end(), cont2.end());
|
||||||
BOOST_CHECK( pair_mmit.first == cont1.end() );
|
eval_mismatch(cont1, cont2, std::equal_to<int>(), cont1.end(), cont2.end());
|
||||||
BOOST_CHECK( pair_mmit.second == cont2.end() );
|
eval_mismatch(cref_cont1, cont2, cref_cont1.end(), cont2.end());
|
||||||
pair_mmit = boost::mismatch(cont1, cont2, std::equal_to<int>());
|
eval_mismatch(cref_cont1, cont2, std::equal_to<int>(), cref_cont1.end(), cont2.end());
|
||||||
BOOST_CHECK( pair_mmit.first == cont1.end() );
|
eval_mismatch(cont1, cref_cont2, cont1.end(), cref_cont2.end());
|
||||||
BOOST_CHECK( pair_mmit.second == cont2.end() );
|
eval_mismatch(cont1, cref_cont2, std::equal_to<int>(), cont1.end(), cref_cont2.end());
|
||||||
|
eval_mismatch(cref_cont1, cref_cont2, cref_cont1.end(), cref_cont2.end());
|
||||||
pair_cmit_t pair_cmit = boost::mismatch(cref_cont1, cont2);
|
eval_mismatch(cref_cont1, cref_cont2, std::equal_to<int>(), cref_cont1.end(), cref_cont2.end());
|
||||||
BOOST_CHECK( pair_cmit.first == cref_cont1.end() );
|
|
||||||
BOOST_CHECK( pair_cmit.second == cont2.end() );
|
|
||||||
pair_cmit = boost::mismatch(cref_cont1, cont2, std::equal_to<int>());
|
|
||||||
BOOST_CHECK( pair_cmit.first == cref_cont1.end() );
|
|
||||||
BOOST_CHECK( pair_cmit.second == cont2.end() );
|
|
||||||
|
|
||||||
pair_mcit_t pair_mcit = boost::mismatch(cont1, cref_cont2);
|
|
||||||
BOOST_CHECK( pair_mcit.first == cont1.end() );
|
|
||||||
BOOST_CHECK( pair_mcit.second == cref_cont2.end() );
|
|
||||||
pair_mcit = boost::mismatch(cont1, cref_cont2, std::equal_to<int>());
|
|
||||||
BOOST_CHECK( pair_mcit.first == cont1.end() );
|
|
||||||
BOOST_CHECK( pair_mcit.second == cref_cont2.end() );
|
|
||||||
|
|
||||||
pair_ccit_t pair_ccit = boost::mismatch(cref_cont1, cref_cont2);
|
|
||||||
BOOST_CHECK( pair_ccit.first == cref_cont1.end() );
|
|
||||||
BOOST_CHECK( pair_ccit.second == cref_cont2.end() );
|
|
||||||
pair_ccit = boost::mismatch(cref_cont1, cref_cont2, std::equal_to<int>());
|
|
||||||
BOOST_CHECK( pair_ccit.first == cref_cont1.end() );
|
|
||||||
BOOST_CHECK( pair_ccit.second == cref_cont2.end() );
|
|
||||||
|
|
||||||
cont1 += 1,2,3,4;
|
cont1 += 1,2,3,4;
|
||||||
cont2 += 1,2,3,4;
|
cont2 += 1,2,3,4;
|
||||||
pair_mmit = boost::mismatch(cont1, cont2);
|
eval_mismatch(cont1, cont2, cont1.end(), cont2.end());
|
||||||
BOOST_CHECK( pair_mmit.first == cont1.end() );
|
eval_mismatch(cont1, cont2, std::equal_to<int>(), cont1.end(), cont2.end());
|
||||||
BOOST_CHECK( pair_mmit.second == cont2.end() );
|
eval_mismatch(cref_cont1, cont2, cref_cont1.end(), cont2.end());
|
||||||
pair_mmit = boost::mismatch(cont1, cont2, std::equal_to<int>());
|
eval_mismatch(cref_cont1, cont2, std::equal_to<int>(), cref_cont1.end(), cont2.end());
|
||||||
BOOST_CHECK( pair_mmit.first == cont1.end() );
|
eval_mismatch(cont1, cref_cont2, cont1.end(), cref_cont2.end());
|
||||||
BOOST_CHECK( pair_mmit.second == cont2.end() );
|
eval_mismatch(cont1, cref_cont2, std::equal_to<int>(), cont1.end(), cref_cont2.end());
|
||||||
|
eval_mismatch(cref_cont1, cref_cont2, cref_cont1.end(), cref_cont2.end());
|
||||||
pair_cmit = boost::mismatch(cref_cont1, cont2);
|
eval_mismatch(cref_cont1, cref_cont2, std::equal_to<int>(), cref_cont1.end(), cref_cont2.end());
|
||||||
BOOST_CHECK( pair_cmit.first == cref_cont1.end() );
|
|
||||||
BOOST_CHECK( pair_cmit.second == cont2.end() );
|
|
||||||
pair_cmit = boost::mismatch(cref_cont1, cont2, std::equal_to<int>());
|
|
||||||
BOOST_CHECK( pair_cmit.first == cref_cont1.end() );
|
|
||||||
BOOST_CHECK( pair_cmit.second == cont2.end() );
|
|
||||||
|
|
||||||
pair_mcit = boost::mismatch(cont1, cref_cont2);
|
|
||||||
BOOST_CHECK( pair_mcit.first == cont1.end() );
|
|
||||||
BOOST_CHECK( pair_mcit.second == cref_cont2.end() );
|
|
||||||
pair_mcit = boost::mismatch(cont1, cref_cont2, std::equal_to<int>());
|
|
||||||
BOOST_CHECK( pair_mcit.first == cont1.end() );
|
|
||||||
BOOST_CHECK( pair_mcit.second == cref_cont2.end() );
|
|
||||||
|
|
||||||
pair_ccit = boost::mismatch(cref_cont1, cref_cont2);
|
|
||||||
BOOST_CHECK( pair_ccit.first == cref_cont1.end() );
|
|
||||||
BOOST_CHECK( pair_ccit.second == cref_cont2.end() );
|
|
||||||
pair_ccit = boost::mismatch(cref_cont1, cref_cont2, std::equal_to<int>());
|
|
||||||
BOOST_CHECK( pair_ccit.first == cref_cont1.end() );
|
|
||||||
BOOST_CHECK( pair_ccit.second == cref_cont2.end() );
|
|
||||||
|
|
||||||
cont1.clear();
|
cont1.clear();
|
||||||
cont2.clear();
|
cont2.clear();
|
||||||
cont1 += 1,2,3,4;
|
cont1 += 1,2,3,4;
|
||||||
cont2 += 1,2,5,4;
|
cont2 += 1,2,5,4;
|
||||||
pair_mmit = boost::mismatch(cont1, cont2);
|
eval_mismatch(cont1, cont2, 3, 5);
|
||||||
BOOST_CHECK( pair_mmit.first != cont1.end() && *pair_mmit.first == 3 );
|
eval_mismatch(cont1, cont2, std::equal_to<int>(), 3, 5);
|
||||||
BOOST_CHECK( pair_mmit.second != cont2.end() && *pair_mmit.second == 5 );
|
eval_mismatch(cont1, cont2, std::not_equal_to<int>(), cont1.begin(), cont2.begin());
|
||||||
pair_mmit = boost::mismatch(cont1, cont2, std::equal_to<int>());
|
eval_mismatch(cref_cont1, cont2, 3, 5);
|
||||||
BOOST_CHECK( pair_mmit.first != cont1.end() && *pair_mmit.first == 3 );
|
eval_mismatch(cref_cont1, cont2, std::equal_to<int>(), 3, 5);
|
||||||
BOOST_CHECK( pair_mmit.second != cont2.end() && *pair_mmit.second == 5 );
|
eval_mismatch(cref_cont1, cont2, std::not_equal_to<int>(), cref_cont1.begin(), cont2.begin());
|
||||||
pair_mmit = boost::mismatch(cont1, cont2, std::not_equal_to<int>());
|
eval_mismatch(cont1, cref_cont2, 3, 5);
|
||||||
BOOST_CHECK( pair_mmit.first == cont1.begin() );
|
eval_mismatch(cont1, cref_cont2, std::equal_to<int>(), 3, 5);
|
||||||
BOOST_CHECK( pair_mmit.second == cont2.begin() );
|
eval_mismatch(cont1, cref_cont2, std::not_equal_to<int>(), cont1.begin(), cref_cont2.begin());
|
||||||
|
eval_mismatch(cref_cont1, cref_cont2, 3, 5);
|
||||||
pair_cmit = boost::mismatch(cref_cont1, cont2);
|
eval_mismatch(cref_cont1, cref_cont2, std::equal_to<int>(), 3, 5);
|
||||||
BOOST_CHECK( pair_cmit.first != cref_cont1.end() && *pair_cmit.first == 3 );
|
eval_mismatch(cref_cont1, cref_cont2, std::not_equal_to<int>(), cref_cont1.begin(), cref_cont2.begin());
|
||||||
BOOST_CHECK( pair_cmit.second != cont2.end() && *pair_cmit.second == 5 );
|
|
||||||
pair_cmit = boost::mismatch(cref_cont1, cont2, std::equal_to<int>());
|
|
||||||
BOOST_CHECK( pair_cmit.first != cref_cont1.end() && *pair_cmit.first == 3 );
|
|
||||||
BOOST_CHECK( pair_cmit.second != cont2.end() && *pair_cmit.second == 5 );
|
|
||||||
pair_cmit = boost::mismatch(cref_cont1, cont2, std::not_equal_to<int>());
|
|
||||||
BOOST_CHECK( pair_cmit.first == cref_cont1.begin() );
|
|
||||||
BOOST_CHECK( pair_cmit.second == cont2.begin() );
|
|
||||||
|
|
||||||
pair_mcit = boost::mismatch(cont1, cref_cont2);
|
|
||||||
BOOST_CHECK( pair_mcit.first != cont1.end() && *pair_mcit.first == 3 );
|
|
||||||
BOOST_CHECK( pair_mcit.second != cref_cont2.end() && *pair_mcit.second == 5 );
|
|
||||||
pair_mcit = boost::mismatch(cont1, cref_cont2, std::equal_to<int>());
|
|
||||||
BOOST_CHECK( pair_mcit.first != cont1.end() && *pair_mcit.first == 3 );
|
|
||||||
BOOST_CHECK( pair_mcit.second != cref_cont2.end() && *pair_mcit.second == 5 );
|
|
||||||
pair_mcit = boost::mismatch(cont1, cref_cont2, std::not_equal_to<int>());
|
|
||||||
BOOST_CHECK( pair_mcit.first == cont1.begin() );
|
|
||||||
BOOST_CHECK( pair_mcit.second == cref_cont2.begin() );
|
|
||||||
|
|
||||||
pair_ccit = boost::mismatch(cref_cont1, cref_cont2);
|
|
||||||
BOOST_CHECK( pair_ccit.first != cref_cont1.end() && *pair_ccit.first == 3 );
|
|
||||||
BOOST_CHECK( pair_ccit.second != cref_cont2.end() && *pair_ccit.second == 5 );
|
|
||||||
pair_ccit = boost::mismatch(cref_cont1, cref_cont2, std::equal_to<int>());
|
|
||||||
BOOST_CHECK( pair_ccit.first != cref_cont1.end() && *pair_ccit.first == 3 );
|
|
||||||
BOOST_CHECK( pair_ccit.second != cref_cont2.end() && *pair_ccit.second == 5 );
|
|
||||||
pair_ccit = boost::mismatch(cref_cont1, cref_cont2, std::not_equal_to<int>());
|
|
||||||
BOOST_CHECK( pair_ccit.first == cref_cont1.begin() );
|
|
||||||
BOOST_CHECK( pair_ccit.second == cref_cont2.begin() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_mismatch()
|
void test_mismatch()
|
||||||
|
@ -29,11 +29,19 @@ namespace boost
|
|||||||
const bool reference_ret
|
const bool reference_ret
|
||||||
= std::next_permutation(reference.begin(), reference.end());
|
= std::next_permutation(reference.begin(), reference.end());
|
||||||
|
|
||||||
const bool test_ret
|
const bool test_ret = boost::next_permutation(test);
|
||||||
= boost::next_permutation(test);
|
|
||||||
|
|
||||||
BOOST_CHECK( reference_ret == test_ret );
|
BOOST_CHECK( reference_ret == test_ret );
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS(
|
||||||
|
reference.begin(), reference.end(),
|
||||||
|
test.begin(), test.end()
|
||||||
|
);
|
||||||
|
|
||||||
|
test = cont;
|
||||||
|
|
||||||
|
BOOST_CHECK( test_ret == boost::next_permutation(boost::make_iterator_range(test)) );
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS(
|
BOOST_CHECK_EQUAL_COLLECTIONS(
|
||||||
reference.begin(), reference.end(),
|
reference.begin(), reference.end(),
|
||||||
test.begin(), test.end()
|
test.begin(), test.end()
|
||||||
@ -56,6 +64,15 @@ namespace boost
|
|||||||
|
|
||||||
BOOST_CHECK( reference_ret == test_ret );
|
BOOST_CHECK( reference_ret == test_ret );
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS(
|
||||||
|
reference.begin(), reference.end(),
|
||||||
|
test.begin(), test.end()
|
||||||
|
);
|
||||||
|
|
||||||
|
test = cont;
|
||||||
|
|
||||||
|
BOOST_CHECK( test_ret == boost::next_permutation(boost::make_iterator_range(test), pred) );
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS(
|
BOOST_CHECK_EQUAL_COLLECTIONS(
|
||||||
reference.begin(), reference.end(),
|
reference.begin(), reference.end(),
|
||||||
test.begin(), test.end()
|
test.begin(), test.end()
|
||||||
|
@ -29,7 +29,21 @@ namespace boost
|
|||||||
template<class Container, class Iterator>
|
template<class Container, class Iterator>
|
||||||
void test_nth_element(Container& cont, Iterator mid)
|
void test_nth_element(Container& cont, Iterator mid)
|
||||||
{
|
{
|
||||||
|
const Container old_cont(cont);
|
||||||
|
|
||||||
boost::nth_element(cont, mid);
|
boost::nth_element(cont, mid);
|
||||||
|
|
||||||
|
// Test the same operation on the container, for the
|
||||||
|
// case where a temporary is passed as the first
|
||||||
|
// argument.
|
||||||
|
Container cont2(old_cont);
|
||||||
|
const std::size_t index = std::distance(cont.begin(), mid);
|
||||||
|
Iterator mid2(cont2.begin());
|
||||||
|
std::advance(mid2, index);
|
||||||
|
boost::nth_element(boost::make_iterator_range(cont2), mid2);
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( cont.begin(), cont.end(),
|
||||||
|
cont2.begin(), cont2.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container, class Iterator>
|
template<class Container, class Iterator>
|
||||||
@ -45,7 +59,19 @@ namespace boost
|
|||||||
template<class Container, class Iterator>
|
template<class Container, class Iterator>
|
||||||
void test_nth_element(Container& cont, Iterator mid)
|
void test_nth_element(Container& cont, Iterator mid)
|
||||||
{
|
{
|
||||||
|
const Container old_cont(cont);
|
||||||
|
|
||||||
boost::nth_element(cont, mid, BinaryPredicate());
|
boost::nth_element(cont, mid, BinaryPredicate());
|
||||||
|
|
||||||
|
Container cont2(old_cont);
|
||||||
|
const std::size_t index = std::distance(cont.begin(), mid);
|
||||||
|
Iterator mid2(cont2.begin());
|
||||||
|
std::advance(mid2, index);
|
||||||
|
boost::nth_element(boost::make_iterator_range(cont2), mid2,
|
||||||
|
BinaryPredicate());
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( cont.begin(), cont.end(),
|
||||||
|
cont2.begin(), cont2.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container, class Iterator>
|
template<class Container, class Iterator>
|
||||||
|
@ -31,7 +31,18 @@ namespace boost
|
|||||||
template<class Container, class Iterator>
|
template<class Container, class Iterator>
|
||||||
void test_partial_sort(Container& cont, Iterator mid)
|
void test_partial_sort(Container& cont, Iterator mid)
|
||||||
{
|
{
|
||||||
|
const Container old_cont(cont);
|
||||||
|
|
||||||
boost::partial_sort(cont, mid);
|
boost::partial_sort(cont, mid);
|
||||||
|
|
||||||
|
const std::size_t index = std::distance(cont.begin(), mid);
|
||||||
|
Container cont2(old_cont);
|
||||||
|
Iterator mid2(cont2.begin());
|
||||||
|
std::advance(mid2, index);
|
||||||
|
boost::partial_sort(cont2, mid2);
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( cont.begin(), cont.end(),
|
||||||
|
cont2.begin(), cont2.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container, class Iterator>
|
template<class Container, class Iterator>
|
||||||
@ -47,7 +58,18 @@ namespace boost
|
|||||||
template<class Container, class Iterator>
|
template<class Container, class Iterator>
|
||||||
void test_partial_sort(Container& cont, Iterator mid)
|
void test_partial_sort(Container& cont, Iterator mid)
|
||||||
{
|
{
|
||||||
|
const Container old_cont(cont);
|
||||||
|
|
||||||
boost::partial_sort(cont, mid, BinaryPredicate());
|
boost::partial_sort(cont, mid, BinaryPredicate());
|
||||||
|
|
||||||
|
const std::size_t index = std::distance(cont.begin(), mid);
|
||||||
|
Container cont2(old_cont);
|
||||||
|
Iterator mid2(cont2.begin());
|
||||||
|
std::advance(mid2, index);
|
||||||
|
boost::partial_sort(cont2, mid2, BinaryPredicate());
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( cont.begin(), cont.end(),
|
||||||
|
cont2.begin(), cont2.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container, class Iterator>
|
template<class Container, class Iterator>
|
||||||
|
@ -41,7 +41,21 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
test_iter(Container& cont)
|
||||||
{
|
{
|
||||||
return boost::partition(cont, UnaryPredicate());
|
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>::type iter_t;
|
||||||
|
|
||||||
|
const Container old_cont(cont);
|
||||||
|
Container cont2(old_cont);
|
||||||
|
iter_t result = boost::partition(cont, UnaryPredicate());
|
||||||
|
|
||||||
|
iter_t temp_result = boost::partition(cont2, UnaryPredicate());
|
||||||
|
cont2 = old_cont;
|
||||||
|
BOOST_CHECK( temp_result == boost::partition(
|
||||||
|
boost::make_iterator_range(cont2), UnaryPredicate()) );
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( cont.begin(), cont.end(),
|
||||||
|
cont2.begin(), cont2.end() );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
UnaryPredicate pred() const { return UnaryPredicate(); }
|
UnaryPredicate pred() const { return UnaryPredicate(); }
|
||||||
@ -53,7 +67,22 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
||||||
operator()(Policy& policy, Container& cont)
|
operator()(Policy& policy, Container& cont)
|
||||||
{
|
{
|
||||||
return boost::partition<return_type>(cont, policy.pred());
|
typedef BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type result_t;
|
||||||
|
|
||||||
|
const Container old_cont(cont);
|
||||||
|
Container cont2(old_cont);
|
||||||
|
result_t result = boost::partition<return_type>(cont, policy.pred());
|
||||||
|
|
||||||
|
result_t temp_result = boost::partition<return_type>(
|
||||||
|
cont2, policy.pred());
|
||||||
|
cont2 = old_cont;
|
||||||
|
BOOST_CHECK( temp_result == boost::partition<return_type>(
|
||||||
|
boost::make_iterator_range(cont2), policy.pred()) );
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( cont.begin(), cont.end(),
|
||||||
|
cont2.begin(), cont2.end() );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -25,12 +25,12 @@ namespace boost
|
|||||||
{
|
{
|
||||||
Container reference(cont);
|
Container reference(cont);
|
||||||
Container test(cont);
|
Container test(cont);
|
||||||
|
Container test2(cont);
|
||||||
|
|
||||||
const bool reference_ret
|
const bool reference_ret
|
||||||
= std::prev_permutation(reference.begin(), reference.end());
|
= std::prev_permutation(reference.begin(), reference.end());
|
||||||
|
|
||||||
const bool test_ret
|
const bool test_ret = boost::prev_permutation(test);
|
||||||
= boost::prev_permutation(test);
|
|
||||||
|
|
||||||
BOOST_CHECK( reference_ret == test_ret );
|
BOOST_CHECK( reference_ret == test_ret );
|
||||||
|
|
||||||
@ -38,6 +38,14 @@ namespace boost
|
|||||||
reference.begin(), reference.end(),
|
reference.begin(), reference.end(),
|
||||||
test.begin(), test.end()
|
test.begin(), test.end()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
BOOST_CHECK( test_ret == boost::prev_permutation(
|
||||||
|
boost::make_iterator_range(test2)) );
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS(
|
||||||
|
reference.begin(), reference.end(),
|
||||||
|
test2.begin(), test2.end()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container, class BinaryPredicate>
|
template<class Container, class BinaryPredicate>
|
||||||
@ -46,13 +54,13 @@ namespace boost
|
|||||||
{
|
{
|
||||||
Container reference(cont);
|
Container reference(cont);
|
||||||
Container test(cont);
|
Container test(cont);
|
||||||
|
Container test2(cont);
|
||||||
|
|
||||||
const bool reference_ret
|
const bool reference_ret
|
||||||
= std::prev_permutation(reference.begin(), reference.end(),
|
= std::prev_permutation(reference.begin(), reference.end(),
|
||||||
pred);
|
pred);
|
||||||
|
|
||||||
const bool test_ret
|
const bool test_ret = boost::prev_permutation(test, pred);
|
||||||
= boost::prev_permutation(test, pred);
|
|
||||||
|
|
||||||
BOOST_CHECK( reference_ret == test_ret );
|
BOOST_CHECK( reference_ret == test_ret );
|
||||||
|
|
||||||
@ -60,6 +68,14 @@ namespace boost
|
|||||||
reference.begin(), reference.end(),
|
reference.begin(), reference.end(),
|
||||||
test.begin(), test.end()
|
test.begin(), test.end()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
BOOST_CHECK( test_ret == boost::prev_permutation(
|
||||||
|
boost::make_iterator_range(test2), pred) );
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS(
|
||||||
|
reference.begin(), reference.end(),
|
||||||
|
test2.begin(), test2.end()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container>
|
template<class Container>
|
||||||
|
@ -110,6 +110,14 @@ namespace boost
|
|||||||
{
|
{
|
||||||
shuffled = true;
|
shuffled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Verify that the shuffle can be performed on a
|
||||||
|
// temporary range
|
||||||
|
Container test2(cont);
|
||||||
|
boost::random_shuffle(boost::make_iterator_range(test2));
|
||||||
|
ok = test_shuffle_result(cont, test2);
|
||||||
|
if (!ok)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,6 +132,17 @@ namespace boost
|
|||||||
{
|
{
|
||||||
BOOST_CHECK( gen.invocation_count() > 0 );
|
BOOST_CHECK( gen.invocation_count() > 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test that random shuffle works when
|
||||||
|
// passed a temporary range
|
||||||
|
RandomGenerator gen2;
|
||||||
|
Container cont2(old_cont);
|
||||||
|
boost::random_shuffle(boost::make_iterator_range(cont2), gen2);
|
||||||
|
test_shuffle_result(cont2, old_cont);
|
||||||
|
if (cont2.size() > 2)
|
||||||
|
{
|
||||||
|
BOOST_CHECK( gen2.invocation_count() > 0 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container>
|
template<class Container>
|
||||||
|
@ -44,6 +44,15 @@ namespace boost
|
|||||||
|
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
test.begin(), test.end() );
|
test.begin(), test.end() );
|
||||||
|
|
||||||
|
Container test2(c);
|
||||||
|
iterator_t test_it2 = boost::remove(test2, to_remove);
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL( std::distance(test2.begin(), test_it2),
|
||||||
|
std::distance(reference.begin(), reference_it) );
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
|
test2.begin(), test2.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
template< class Container >
|
template< class Container >
|
||||||
|
@ -50,6 +50,15 @@ namespace
|
|||||||
|
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
test.begin(), test.end() );
|
test.begin(), test.end() );
|
||||||
|
|
||||||
|
std::vector<value_type> test2;
|
||||||
|
test_append(
|
||||||
|
boost::remove_copy(boost::make_iterator_range(c),
|
||||||
|
std::back_inserter(test2), to_remove),
|
||||||
|
to_remove);
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
|
test2.begin(), test2.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
template< class Container >
|
template< class Container >
|
||||||
|
@ -49,6 +49,16 @@ namespace
|
|||||||
|
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
test.begin(), test.end() );
|
test.begin(), test.end() );
|
||||||
|
|
||||||
|
std::vector<value_type> test2;
|
||||||
|
test_append(
|
||||||
|
boost::remove_copy_if(boost::make_iterator_range(c),
|
||||||
|
std::back_inserter(test2), pred),
|
||||||
|
value_type()
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
|
test2.begin(), test2.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
template< class Container >
|
template< class Container >
|
||||||
|
@ -44,6 +44,16 @@ namespace boost
|
|||||||
|
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
test.begin(), test.end() );
|
test.begin(), test.end() );
|
||||||
|
|
||||||
|
Container test2(c);
|
||||||
|
iterator_t test_it2 = boost::remove_if(
|
||||||
|
boost::make_iterator_range(test2), pred);
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL( std::distance(test2.begin(), test_it2),
|
||||||
|
std::distance(reference.begin(), reference_it) );
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
|
test2.begin(), test2.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
template< class Container >
|
template< class Container >
|
||||||
|
@ -38,6 +38,13 @@ namespace boost
|
|||||||
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
target.begin(), target.end() );
|
target.begin(), target.end() );
|
||||||
|
|
||||||
|
std::vector<int> target2(cont.begin(), cont.end());
|
||||||
|
boost::replace(boost::make_iterator_range(target2), what,
|
||||||
|
with_what);
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
|
target2.begin(), target2.end() );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template< class Container >
|
template< class Container >
|
||||||
|
@ -52,6 +52,16 @@ namespace
|
|||||||
|
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
test.begin(), test.end() );
|
test.begin(), test.end() );
|
||||||
|
|
||||||
|
std::vector<value_type> test2;
|
||||||
|
test_append(
|
||||||
|
boost::replace_copy(boost::make_iterator_range(c),
|
||||||
|
std::back_inserter(test2), to_replace,
|
||||||
|
replace_with),
|
||||||
|
to_replace);
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
|
test2.begin(), test2.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
template< class Container >
|
template< class Container >
|
||||||
|
@ -50,6 +50,17 @@ namespace
|
|||||||
|
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
test.begin(), test.end() );
|
test.begin(), test.end() );
|
||||||
|
|
||||||
|
std::vector<value_type> test2;
|
||||||
|
test_append(
|
||||||
|
boost::replace_copy_if(boost::make_iterator_range(c),
|
||||||
|
std::back_inserter(test2), pred,
|
||||||
|
replace_with),
|
||||||
|
value_type()
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
|
test2.begin(), test2.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
template< class Container >
|
template< class Container >
|
||||||
|
@ -42,6 +42,12 @@ namespace boost
|
|||||||
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
target.begin(), target.end() );
|
target.begin(), target.end() );
|
||||||
|
|
||||||
|
std::vector<int> target2(cont.begin(), cont.end());
|
||||||
|
boost::replace_if(boost::make_iterator_range(target2),
|
||||||
|
boost::bind(pred, _1, what), with_what);
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
|
target2.begin(), target2.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
template< class Container >
|
template< class Container >
|
||||||
|
@ -29,14 +29,16 @@ namespace boost
|
|||||||
{
|
{
|
||||||
Container reference(cont);
|
Container reference(cont);
|
||||||
Container test(cont);
|
Container test(cont);
|
||||||
|
Container test2(cont);
|
||||||
|
|
||||||
boost::reverse(test);
|
boost::reverse(test);
|
||||||
std::reverse(reference.begin(), reference.end());
|
std::reverse(reference.begin(), reference.end());
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
|
test.begin(), test.end() );
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS(
|
boost::reverse(boost::make_iterator_range(test2));
|
||||||
reference.begin(), reference.end(),
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
test.begin(), test.end()
|
test2.begin(), test2.end() );
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container>
|
template<class Container>
|
||||||
|
@ -45,10 +45,19 @@ namespace
|
|||||||
value_type()
|
value_type()
|
||||||
);
|
);
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS(
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
reference.begin(), reference.end(),
|
test.begin(), test.end() );
|
||||||
test.begin(), test.end()
|
|
||||||
|
test.clear();
|
||||||
|
|
||||||
|
test_append(
|
||||||
|
boost::reverse_copy(boost::make_iterator_range(cont),
|
||||||
|
std::back_inserter(test)),
|
||||||
|
value_type()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
|
test.begin(), test.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container>
|
template<class Container>
|
||||||
|
@ -42,10 +42,18 @@ namespace boost
|
|||||||
|
|
||||||
boost::rotate(test, test_where_it);
|
boost::rotate(test, test_where_it);
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS(
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
reference.begin(), reference.end(),
|
test.begin(), test.end() );
|
||||||
test.begin(), test.end()
|
|
||||||
);
|
test = cont;
|
||||||
|
test_where_it = test.begin();
|
||||||
|
std::advance(test_where_it,
|
||||||
|
std::distance(cont.begin(), where_it));
|
||||||
|
|
||||||
|
boost::rotate(boost::make_iterator_range(test), test_where_it);
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
|
test.begin(), test.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container>
|
template<class Container>
|
||||||
|
@ -48,10 +48,19 @@ namespace
|
|||||||
value_type()
|
value_type()
|
||||||
);
|
);
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS(
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
reference.begin(), reference.end(),
|
test.begin(), test.end() );
|
||||||
test.begin(), test.end()
|
|
||||||
|
test.clear();
|
||||||
|
|
||||||
|
test_append(
|
||||||
|
boost::rotate_copy(boost::make_iterator_range(cont), where_it,
|
||||||
|
std::back_inserter(test)),
|
||||||
|
value_type()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
|
test.begin(), test.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container>
|
template<class Container>
|
||||||
|
@ -33,9 +33,25 @@ namespace boost
|
|||||||
const Container2& ccont2 = cont2;
|
const Container2& ccont2 = cont2;
|
||||||
|
|
||||||
iterator1_t it = boost::search(cont1, cont2);
|
iterator1_t it = boost::search(cont1, cont2);
|
||||||
|
BOOST_CHECK( it == boost::search(boost::make_iterator_range(cont1), cont2) );
|
||||||
|
BOOST_CHECK( it == boost::search(cont1, boost::make_iterator_range(cont2)) );
|
||||||
|
BOOST_CHECK( it == boost::search(boost::make_iterator_range(cont1),
|
||||||
|
boost::make_iterator_range(cont2)) );
|
||||||
iterator1_t it2 = boost::search(cont1, ccont2);
|
iterator1_t it2 = boost::search(cont1, ccont2);
|
||||||
|
BOOST_CHECK( it2 == boost::search(boost::make_iterator_range(cont1), ccont2) );
|
||||||
|
BOOST_CHECK( it2 == boost::search(cont1, boost::make_iterator_range(ccont2)) );
|
||||||
|
BOOST_CHECK( it2 == boost::search(boost::make_iterator_range(cont1),
|
||||||
|
boost::make_iterator_range(ccont2)) );
|
||||||
const_iterator1_t cit = boost::search(ccont1, cont2);
|
const_iterator1_t cit = boost::search(ccont1, cont2);
|
||||||
|
BOOST_CHECK( cit == boost::search(boost::make_iterator_range(ccont1), cont2) );
|
||||||
|
BOOST_CHECK( cit == boost::search(ccont1, boost::make_iterator_range(cont2)) );
|
||||||
|
BOOST_CHECK( cit == boost::search(boost::make_iterator_range(ccont1),
|
||||||
|
boost::make_iterator_range(cont2)) );
|
||||||
const_iterator1_t cit2 = boost::search(ccont1, ccont2);
|
const_iterator1_t cit2 = boost::search(ccont1, ccont2);
|
||||||
|
BOOST_CHECK( cit2 == boost::search(boost::make_iterator_range(ccont1), ccont2) );
|
||||||
|
BOOST_CHECK( cit2 == boost::search(ccont1, boost::make_iterator_range(ccont2)) );
|
||||||
|
BOOST_CHECK( cit2 == boost::search(boost::make_iterator_range(ccont1),
|
||||||
|
boost::make_iterator_range(ccont2)) );
|
||||||
|
|
||||||
BOOST_CHECK( it == std::search(cont1.begin(), cont1.end(), cont2.begin(), cont2.end()) );
|
BOOST_CHECK( it == std::search(cont1.begin(), cont1.end(), cont2.begin(), cont2.end()) );
|
||||||
BOOST_CHECK( it2 == std::search(cont1.begin(), cont1.end(), ccont2.begin(), ccont2.end()) );
|
BOOST_CHECK( it2 == std::search(cont1.begin(), cont1.end(), ccont2.begin(), ccont2.end()) );
|
||||||
|
@ -32,14 +32,12 @@ namespace
|
|||||||
for (std::size_t n = 0; n < cont1.size(); ++n)
|
for (std::size_t n = 0; n < cont1.size(); ++n)
|
||||||
{
|
{
|
||||||
iterator1_t it = boost::search_n(cont1, n, value);
|
iterator1_t it = boost::search_n(cont1, n, value);
|
||||||
iterator1_t it2 = boost::search_n(cont1, n, value);
|
BOOST_CHECK( it == boost::search_n(boost::make_iterator_range(cont1), n, value) );
|
||||||
const_iterator1_t cit = boost::search_n(ccont1, n, value);
|
|
||||||
const_iterator1_t cit2 = boost::search_n(ccont1, n, value);
|
|
||||||
|
|
||||||
BOOST_CHECK( it == std::search_n(cont1.begin(), cont1.end(), n, value) );
|
BOOST_CHECK( it == std::search_n(cont1.begin(), cont1.end(), n, value) );
|
||||||
BOOST_CHECK( it2 == std::search_n(cont1.begin(), cont1.end(), n, value) );
|
|
||||||
|
const_iterator1_t cit = boost::search_n(ccont1, n, value);
|
||||||
|
BOOST_CHECK( cit == boost::search_n(boost::make_iterator_range(ccont1), n, value) );
|
||||||
BOOST_CHECK( cit == std::search_n(ccont1.begin(), ccont1.end(), n, value) );
|
BOOST_CHECK( cit == std::search_n(ccont1.begin(), ccont1.end(), n, value) );
|
||||||
BOOST_CHECK( cit2 == std::search_n(ccont1.begin(), ccont1.end(), n, value) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,6 +62,28 @@ namespace boost
|
|||||||
|
|
||||||
check_result(reference, reference_result,
|
check_result(reference, reference_result,
|
||||||
test_cont, test_result);
|
test_cont, test_result);
|
||||||
|
|
||||||
|
test_result = boost::set_difference(
|
||||||
|
boost::make_iterator_range(cont1), cont2,
|
||||||
|
test_cont.begin());
|
||||||
|
|
||||||
|
check_result(reference, reference_result,
|
||||||
|
test_cont, test_result);
|
||||||
|
|
||||||
|
test_result = boost::set_difference(
|
||||||
|
cont1, boost::make_iterator_range(cont2),
|
||||||
|
test_cont.begin());
|
||||||
|
|
||||||
|
check_result(reference, reference_result,
|
||||||
|
test_cont, test_result);
|
||||||
|
|
||||||
|
test_result = boost::set_difference(
|
||||||
|
boost::make_iterator_range(cont1),
|
||||||
|
boost::make_iterator_range(cont2),
|
||||||
|
test_cont.begin());
|
||||||
|
|
||||||
|
check_result(reference, reference_result,
|
||||||
|
test_cont, test_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container, class BinaryPredicate>
|
template<class Container, class BinaryPredicate>
|
||||||
@ -100,6 +122,28 @@ namespace boost
|
|||||||
|
|
||||||
check_result(reference, reference_result,
|
check_result(reference, reference_result,
|
||||||
test_cont, test_result);
|
test_cont, test_result);
|
||||||
|
|
||||||
|
test_result = boost::set_difference(
|
||||||
|
boost::make_iterator_range(cont1), cont2,
|
||||||
|
test_cont.begin(), pred);
|
||||||
|
|
||||||
|
check_result(reference, reference_result,
|
||||||
|
test_cont, test_result);
|
||||||
|
|
||||||
|
test_result = boost::set_difference(
|
||||||
|
cont1, boost::make_iterator_range(cont2),
|
||||||
|
test_cont.begin(), pred);
|
||||||
|
|
||||||
|
check_result(reference, reference_result,
|
||||||
|
test_cont, test_result);
|
||||||
|
|
||||||
|
test_result = boost::set_difference(
|
||||||
|
boost::make_iterator_range(cont1),
|
||||||
|
boost::make_iterator_range(cont2),
|
||||||
|
test_cont.begin(), pred);
|
||||||
|
|
||||||
|
check_result(reference, reference_result,
|
||||||
|
test_cont, test_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container1, class Container2>
|
template<class Container1, class Container2>
|
||||||
|
@ -62,6 +62,28 @@ namespace boost
|
|||||||
|
|
||||||
check_result(reference, reference_result,
|
check_result(reference, reference_result,
|
||||||
test_cont, test_result);
|
test_cont, test_result);
|
||||||
|
|
||||||
|
test_result = boost::set_intersection(
|
||||||
|
boost::make_iterator_range(cont1), cont2,
|
||||||
|
test_cont.begin());
|
||||||
|
|
||||||
|
check_result(reference, reference_result,
|
||||||
|
test_cont, test_result);
|
||||||
|
|
||||||
|
test_result = boost::set_intersection(
|
||||||
|
cont1, boost::make_iterator_range(cont2),
|
||||||
|
test_cont.begin());
|
||||||
|
|
||||||
|
check_result(reference, reference_result,
|
||||||
|
test_cont, test_result);
|
||||||
|
|
||||||
|
test_result = boost::set_intersection(
|
||||||
|
boost::make_iterator_range(cont1),
|
||||||
|
boost::make_iterator_range(cont2),
|
||||||
|
test_cont.begin());
|
||||||
|
|
||||||
|
check_result(reference, reference_result,
|
||||||
|
test_cont, test_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container, class BinaryPredicate>
|
template<class Container, class BinaryPredicate>
|
||||||
@ -100,6 +122,28 @@ namespace boost
|
|||||||
|
|
||||||
check_result(reference, reference_result,
|
check_result(reference, reference_result,
|
||||||
test_cont, test_result);
|
test_cont, test_result);
|
||||||
|
|
||||||
|
test_result = boost::set_intersection(
|
||||||
|
boost::make_iterator_range(cont1), cont2,
|
||||||
|
test_cont.begin(), pred);
|
||||||
|
|
||||||
|
check_result(reference, reference_result,
|
||||||
|
test_cont, test_result);
|
||||||
|
|
||||||
|
test_result = boost::set_intersection(
|
||||||
|
cont1, boost::make_iterator_range(cont2),
|
||||||
|
test_cont.begin(), pred);
|
||||||
|
|
||||||
|
check_result(reference, reference_result,
|
||||||
|
test_cont, test_result);
|
||||||
|
|
||||||
|
test_result = boost::set_intersection(
|
||||||
|
boost::make_iterator_range(cont1),
|
||||||
|
boost::make_iterator_range(cont2),
|
||||||
|
test_cont.begin(), pred);
|
||||||
|
|
||||||
|
check_result(reference, reference_result,
|
||||||
|
test_cont, test_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container1, class Container2>
|
template<class Container1, class Container2>
|
||||||
|
@ -63,6 +63,28 @@ namespace boost
|
|||||||
|
|
||||||
check_result(reference, reference_result,
|
check_result(reference, reference_result,
|
||||||
test_cont, test_result);
|
test_cont, test_result);
|
||||||
|
|
||||||
|
test_result = boost::set_symmetric_difference(
|
||||||
|
boost::make_iterator_range(cont1), cont2,
|
||||||
|
test_cont.begin());
|
||||||
|
|
||||||
|
check_result(reference, reference_result,
|
||||||
|
test_cont, test_result);
|
||||||
|
|
||||||
|
test_result = boost::set_symmetric_difference(
|
||||||
|
cont1, boost::make_iterator_range(cont2),
|
||||||
|
test_cont.begin());
|
||||||
|
|
||||||
|
check_result(reference, reference_result,
|
||||||
|
test_cont, test_result);
|
||||||
|
|
||||||
|
test_result = boost::set_symmetric_difference(
|
||||||
|
boost::make_iterator_range(cont1),
|
||||||
|
boost::make_iterator_range(cont2),
|
||||||
|
test_cont.begin());
|
||||||
|
|
||||||
|
check_result(reference, reference_result,
|
||||||
|
test_cont, test_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container, class BinaryPredicate>
|
template<class Container, class BinaryPredicate>
|
||||||
@ -102,6 +124,28 @@ namespace boost
|
|||||||
|
|
||||||
check_result(reference, reference_result,
|
check_result(reference, reference_result,
|
||||||
test_cont, test_result);
|
test_cont, test_result);
|
||||||
|
|
||||||
|
test_result = boost::set_symmetric_difference(
|
||||||
|
boost::make_iterator_range(cont1), cont2,
|
||||||
|
test_cont.begin(), pred);
|
||||||
|
|
||||||
|
check_result(reference, reference_result,
|
||||||
|
test_cont, test_result);
|
||||||
|
|
||||||
|
test_result = boost::set_symmetric_difference(
|
||||||
|
cont1, boost::make_iterator_range(cont2),
|
||||||
|
test_cont.begin(), pred);
|
||||||
|
|
||||||
|
check_result(reference, reference_result,
|
||||||
|
test_cont, test_result);
|
||||||
|
|
||||||
|
test_result = boost::set_symmetric_difference(
|
||||||
|
boost::make_iterator_range(cont1),
|
||||||
|
boost::make_iterator_range(cont2),
|
||||||
|
test_cont.begin(), pred);
|
||||||
|
|
||||||
|
check_result(reference, reference_result,
|
||||||
|
test_cont, test_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container1, class Container2>
|
template<class Container1, class Container2>
|
||||||
|
@ -62,6 +62,26 @@ namespace boost
|
|||||||
|
|
||||||
check_result(reference, reference_result,
|
check_result(reference, reference_result,
|
||||||
test_cont, test_result);
|
test_cont, test_result);
|
||||||
|
|
||||||
|
test_result = boost::set_union(boost::make_iterator_range(cont1),
|
||||||
|
cont2, test_cont.begin());
|
||||||
|
|
||||||
|
check_result(reference, reference_result,
|
||||||
|
test_cont, test_result);
|
||||||
|
|
||||||
|
test_result = boost::set_union(cont1,
|
||||||
|
boost::make_iterator_range(cont2),
|
||||||
|
test_cont.begin());
|
||||||
|
|
||||||
|
check_result(reference, reference_result,
|
||||||
|
test_cont, test_result);
|
||||||
|
|
||||||
|
test_result = boost::set_union(boost::make_iterator_range(cont1),
|
||||||
|
boost::make_iterator_range(cont2),
|
||||||
|
test_cont.begin());
|
||||||
|
|
||||||
|
check_result(reference, reference_result,
|
||||||
|
test_cont, test_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container, class BinaryPredicate>
|
template<class Container, class BinaryPredicate>
|
||||||
@ -100,6 +120,26 @@ namespace boost
|
|||||||
|
|
||||||
check_result(reference, reference_result,
|
check_result(reference, reference_result,
|
||||||
test_cont, test_result);
|
test_cont, test_result);
|
||||||
|
|
||||||
|
test_result = boost::set_union(boost::make_iterator_range(cont1),
|
||||||
|
cont2, test_cont.begin(), pred);
|
||||||
|
|
||||||
|
check_result(reference, reference_result,
|
||||||
|
test_cont, test_result);
|
||||||
|
|
||||||
|
test_result = boost::set_union(cont1,
|
||||||
|
boost::make_iterator_range(cont2),
|
||||||
|
test_cont.begin(), pred);
|
||||||
|
|
||||||
|
check_result(reference, reference_result,
|
||||||
|
test_cont, test_result);
|
||||||
|
|
||||||
|
test_result = boost::set_union(boost::make_iterator_range(cont1),
|
||||||
|
boost::make_iterator_range(cont2),
|
||||||
|
test_cont.begin(), pred);
|
||||||
|
|
||||||
|
check_result(reference, reference_result,
|
||||||
|
test_cont, test_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container1, class Container2>
|
template<class Container1, class Container2>
|
||||||
|
@ -33,10 +33,13 @@ namespace boost
|
|||||||
boost::sort(test);
|
boost::sort(test);
|
||||||
std::sort(reference.begin(), reference.end());
|
std::sort(reference.begin(), reference.end());
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS(
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
reference.begin(), reference.end(),
|
test.begin(), test.end() );
|
||||||
test.begin(), test.end()
|
|
||||||
);
|
Container test2(cont);
|
||||||
|
boost::sort(boost::make_iterator_range(test2));
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
|
test2.begin(), test2.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container, class BinaryPredicate>
|
template<class Container, class BinaryPredicate>
|
||||||
@ -52,6 +55,11 @@ namespace boost
|
|||||||
reference.begin(), reference.end(),
|
reference.begin(), reference.end(),
|
||||||
test.begin(), test.end()
|
test.begin(), test.end()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Container test2(cont);
|
||||||
|
boost::sort(boost::make_iterator_range(test2), pred);
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
|
test2.begin(), test2.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container>
|
template<class Container>
|
||||||
|
@ -41,7 +41,21 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
test_iter(Container& cont)
|
||||||
{
|
{
|
||||||
return boost::stable_partition(cont, UnaryPredicate());
|
Container cont2(cont);
|
||||||
|
|
||||||
|
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>::type iter_t;
|
||||||
|
iter_t result = boost::stable_partition(cont, UnaryPredicate());
|
||||||
|
|
||||||
|
iter_t temp_result = boost::stable_partition(
|
||||||
|
boost::make_iterator_range(cont2), UnaryPredicate());
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL( std::distance(cont.begin(), result),
|
||||||
|
std::distance(cont2.begin(), temp_result) );
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( cont.begin(), cont.end(),
|
||||||
|
cont2.begin(), cont2.end() );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
UnaryPredicate pred() const { return UnaryPredicate(); }
|
UnaryPredicate pred() const { return UnaryPredicate(); }
|
||||||
@ -53,7 +67,17 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
||||||
operator()(Policy& policy, Container& cont)
|
operator()(Policy& policy, Container& cont)
|
||||||
{
|
{
|
||||||
return boost::stable_partition<return_type>(cont, policy.pred());
|
typedef BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type result_t;
|
||||||
|
Container cont2(cont);
|
||||||
|
result_t result = boost::stable_partition<return_type>(cont, policy.pred());
|
||||||
|
|
||||||
|
result_t result2 = boost::stable_partition<return_type>(
|
||||||
|
boost::make_iterator_range(cont2), policy.pred());
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( cont2.begin(), cont2.end(),
|
||||||
|
cont.begin(), cont.end() );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -33,10 +33,13 @@ namespace boost
|
|||||||
boost::stable_sort(test);
|
boost::stable_sort(test);
|
||||||
std::stable_sort(reference.begin(), reference.end());
|
std::stable_sort(reference.begin(), reference.end());
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS(
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
reference.begin(), reference.end(),
|
test.begin(), test.end() );
|
||||||
test.begin(), test.end()
|
|
||||||
);
|
test = cont;
|
||||||
|
boost::stable_sort(boost::make_iterator_range(test));
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
|
test.begin(), test.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container, class BinaryPredicate>
|
template<class Container, class BinaryPredicate>
|
||||||
@ -48,10 +51,13 @@ namespace boost
|
|||||||
boost::stable_sort(test, pred);
|
boost::stable_sort(test, pred);
|
||||||
std::stable_sort(reference.begin(), reference.end(), pred);
|
std::stable_sort(reference.begin(), reference.end(), pred);
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS(
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
reference.begin(), reference.end(),
|
test.begin(), test.end() );
|
||||||
test.begin(), test.end()
|
|
||||||
);
|
test = cont;
|
||||||
|
boost::stable_sort(boost::make_iterator_range(test), pred);
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
|
test.begin(), test.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container>
|
template<class Container>
|
||||||
|
@ -35,15 +35,36 @@ namespace
|
|||||||
Container2 test2(source2);
|
Container2 test2(source2);
|
||||||
boost::swap_ranges(test1, test2);
|
boost::swap_ranges(test1, test2);
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS(
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference1.begin(), reference1.end(),
|
||||||
reference1.begin(), reference1.end(),
|
test1.begin(), test1.end() );
|
||||||
test1.begin(), test1.end()
|
|
||||||
);
|
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS(
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference2.begin(), reference2.end(),
|
||||||
reference2.begin(), reference2.end(),
|
test2.begin(), test2.end() );
|
||||||
test2.begin(), test2.end()
|
|
||||||
);
|
test1 = source1;
|
||||||
|
test2 = source2;
|
||||||
|
boost::swap_ranges(boost::make_iterator_range(test1), test2);
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference1.begin(), reference1.end(),
|
||||||
|
test1.begin(), test1.end() );
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference2.begin(), reference2.end(),
|
||||||
|
test2.begin(), test2.end() );
|
||||||
|
|
||||||
|
test1 = source1;
|
||||||
|
test2 = source2;
|
||||||
|
boost::swap_ranges(test1, boost::make_iterator_range(test2));
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference1.begin(), reference1.end(),
|
||||||
|
test1.begin(), test1.end() );
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference2.begin(), reference2.end(),
|
||||||
|
test2.begin(), test2.end() );
|
||||||
|
|
||||||
|
test1 = source1;
|
||||||
|
test2 = source2;
|
||||||
|
boost::swap_ranges(boost::make_iterator_range(test1),
|
||||||
|
boost::make_iterator_range(test2));
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference1.begin(), reference1.end(),
|
||||||
|
test1.begin(), test1.end() );
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference2.begin(), reference2.end(),
|
||||||
|
test2.begin(), test2.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container1, class Container2>
|
template<class Container1, class Container2>
|
||||||
|
@ -49,6 +49,10 @@ namespace boost
|
|||||||
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
target.begin(), target.end() );
|
target.begin(), target.end() );
|
||||||
|
|
||||||
|
BOOST_CHECK( test_it == boost::transform(boost::make_iterator_range(cont), target.begin(), fn) );
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
|
target.begin(), target.end() );
|
||||||
|
|
||||||
target.clear();
|
target.clear();
|
||||||
target.resize(ccont.size());
|
target.resize(ccont.size());
|
||||||
|
|
||||||
@ -57,6 +61,9 @@ namespace boost
|
|||||||
BOOST_CHECK( test_it == target.end() );
|
BOOST_CHECK( test_it == target.end() );
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
target.begin(), target.end() );
|
target.begin(), target.end() );
|
||||||
|
BOOST_CHECK( test_it == boost::transform(boost::make_iterator_range(ccont), target.begin(), fn) );
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
|
target.begin(), target.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
template< class Container >
|
template< class Container >
|
||||||
@ -102,6 +109,21 @@ namespace boost
|
|||||||
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
target.begin(), target.end() );
|
target.begin(), target.end() );
|
||||||
|
|
||||||
|
BOOST_CHECK( test_it == boost::transform(boost::make_iterator_range(cont1), cont2, target.begin(), fn) );
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
|
target.begin(), target.end() );
|
||||||
|
|
||||||
|
BOOST_CHECK( test_it == boost::transform(cont1, boost::make_iterator_range(cont2), target.begin(), fn) );
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
|
target.begin(), target.end() );
|
||||||
|
|
||||||
|
BOOST_CHECK( test_it == boost::transform(boost::make_iterator_range(cont1),
|
||||||
|
boost::make_iterator_range(cont2),
|
||||||
|
target.begin(), fn) );
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||||
|
target.begin(), target.end() );
|
||||||
|
|
||||||
|
|
||||||
target.clear();
|
target.clear();
|
||||||
target.resize(ccont1.size());
|
target.resize(ccont1.size());
|
||||||
|
|
||||||
|
@ -47,7 +47,18 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
||||||
operator()(Policy&, Container& cont)
|
operator()(Policy&, Container& cont)
|
||||||
{
|
{
|
||||||
return boost::unique<return_type>(cont);
|
typedef BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type result_t;
|
||||||
|
|
||||||
|
Container cont2(cont);
|
||||||
|
|
||||||
|
result_t result = boost::unique<return_type>(cont);
|
||||||
|
|
||||||
|
boost::unique<return_type>(boost::make_iterator_range(cont2));
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( cont.begin(), cont.end(),
|
||||||
|
cont2.begin(), cont2.end() );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -82,7 +93,18 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type
|
||||||
operator()(Policy& policy, Container& cont)
|
operator()(Policy& policy, Container& cont)
|
||||||
{
|
{
|
||||||
return boost::unique<return_type>(cont, policy.pred());
|
typedef BOOST_DEDUCED_TYPENAME range_return<Container,return_type>::type result_t;
|
||||||
|
|
||||||
|
Container cont2(cont);
|
||||||
|
|
||||||
|
result_t result = boost::unique<return_type>(cont, policy.pred());
|
||||||
|
|
||||||
|
boost::unique<return_type>(boost::make_iterator_range(cont2), policy.pred());
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS( cont.begin(), cont.end(),
|
||||||
|
cont2.begin(), cont2.end() );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -49,6 +49,17 @@ namespace
|
|||||||
|
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS(reference.begin(), reference.end(),
|
BOOST_CHECK_EQUAL_COLLECTIONS(reference.begin(), reference.end(),
|
||||||
test.begin(), test.end());
|
test.begin(), test.end());
|
||||||
|
|
||||||
|
test.clear();
|
||||||
|
|
||||||
|
test_append(
|
||||||
|
boost::unique_copy(boost::make_iterator_range(c),
|
||||||
|
std::back_inserter(test)),
|
||||||
|
value_type()
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS(reference.begin(), reference.end(),
|
||||||
|
test.begin(), test.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container, class Pred>
|
template<class Container, class Pred>
|
||||||
@ -70,6 +81,17 @@ namespace
|
|||||||
|
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS(reference.begin(), reference.end(),
|
BOOST_CHECK_EQUAL_COLLECTIONS(reference.begin(), reference.end(),
|
||||||
test.begin(), test.end());
|
test.begin(), test.end());
|
||||||
|
|
||||||
|
test.clear();
|
||||||
|
|
||||||
|
test_append(
|
||||||
|
boost::unique_copy(boost::make_iterator_range(c),
|
||||||
|
std::back_inserter(test), pred),
|
||||||
|
value_type()
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS(reference.begin(), reference.end(),
|
||||||
|
test.begin(), test.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Container, class Pred>
|
template<class Container, class Pred>
|
||||||
|
@ -32,7 +32,10 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
test_iter(Container& cont)
|
||||||
{
|
{
|
||||||
return boost::upper_bound(cont, 5);
|
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>::type iter_t;
|
||||||
|
iter_t result = boost::upper_bound(cont, 5);
|
||||||
|
BOOST_CHECK( result == boost::upper_bound(boost::make_iterator_range(cont), 5) );
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<range_return_value result_type>
|
template<range_return_value result_type>
|
||||||
@ -42,7 +45,10 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_return<Container,result_type>::type
|
BOOST_DEDUCED_TYPENAME range_return<Container,result_type>::type
|
||||||
operator()(Policy&, Container& cont)
|
operator()(Policy&, Container& cont)
|
||||||
{
|
{
|
||||||
return boost::upper_bound<result_type>(cont, 5);
|
typedef BOOST_DEDUCED_TYPENAME range_return<Container,result_type>::type result_t;
|
||||||
|
result_t result = boost::upper_bound<result_type>(cont, 5);
|
||||||
|
BOOST_CHECK( result == boost::upper_bound<result_type>(boost::make_iterator_range(cont), 5) );
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -61,7 +67,10 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
BOOST_DEDUCED_TYPENAME range_iterator<Container>::type
|
||||||
test_iter(Container& cont)
|
test_iter(Container& cont)
|
||||||
{
|
{
|
||||||
return boost::upper_bound(cont, 5, BinaryPredicate());
|
typedef BOOST_DEDUCED_TYPENAME range_iterator<Container>::type iter_t;
|
||||||
|
iter_t result = boost::upper_bound(cont, 5, BinaryPredicate());
|
||||||
|
BOOST_CHECK( result == boost::upper_bound(boost::make_iterator_range(cont), 5, BinaryPredicate()) );
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template< range_return_value result_type>
|
template< range_return_value result_type>
|
||||||
@ -71,8 +80,14 @@ namespace boost
|
|||||||
BOOST_DEDUCED_TYPENAME range_return<Container,result_type>::type
|
BOOST_DEDUCED_TYPENAME range_return<Container,result_type>::type
|
||||||
operator()(Policy& policy, Container& cont)
|
operator()(Policy& policy, Container& cont)
|
||||||
{
|
{
|
||||||
return boost::upper_bound<result_type>(
|
typedef BOOST_DEDUCED_TYPENAME range_return<Container,result_type>::type result_t;
|
||||||
cont, 5, policy.pred());
|
|
||||||
|
result_t result = boost::upper_bound<result_type>(cont, 5, policy.pred());
|
||||||
|
|
||||||
|
BOOST_CHECK( result == boost::upper_bound<result_type>(
|
||||||
|
boost::make_iterator_range(cont), 5, policy.pred()) );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user