2
0
mirror of https://github.com/boostorg/range.git synced 2026-01-23 17:52:18 +00:00

[boost][range] - Improved handling of temporary ranges in range algorithms.

[SVN r63903]
This commit is contained in:
Neil Groves
2010-07-12 00:12:49 +00:00
parent ef000176d8
commit 74a01a4487
57 changed files with 1178 additions and 216 deletions

View File

@@ -31,7 +31,18 @@ namespace boost
template<class Container, class Iterator>
void test_partial_sort(Container& cont, Iterator mid)
{
const Container old_cont(cont);
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>
@@ -47,7 +58,18 @@ namespace boost
template<class Container, class Iterator>
void test_partial_sort(Container& cont, Iterator mid)
{
const Container old_cont(cont);
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>