mirror of
https://github.com/boostorg/algorithm.git
synced 2025-07-05 08:46:34 +02:00
Add missing ::type in the range-based partition_point implementation. Add test for this call - since there was none before. Thanks to Wygos for the fix.
This commit is contained in:
@ -61,7 +61,7 @@ ForwardIterator partition_point ( ForwardIterator first, ForwardIterator last, P
|
|||||||
/// \param p The predicate to test the values with
|
/// \param p The predicate to test the values with
|
||||||
///
|
///
|
||||||
template <typename Range, typename Predicate>
|
template <typename Range, typename Predicate>
|
||||||
typename boost::range_iterator<Range> partition_point ( Range &r, Predicate p )
|
typename boost::range_iterator<Range>::type partition_point ( Range &r, Predicate p )
|
||||||
{
|
{
|
||||||
return boost::algorithm::partition_point (boost::begin(r), boost::end(r), p);
|
return boost::algorithm::partition_point (boost::begin(r), boost::end(r), p);
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,13 @@ void test_sequence ( Container &v, Predicate comp, int expected ) {
|
|||||||
std::cout << "Expected(2): " << std::distance ( v.begin (), exp )
|
std::cout << "Expected(2): " << std::distance ( v.begin (), exp )
|
||||||
<< ", got: " << std::distance ( v.begin (), res ) << std::endl;
|
<< ", got: " << std::distance ( v.begin (), res ) << std::endl;
|
||||||
BOOST_CHECK ( exp == res );
|
BOOST_CHECK ( exp == res );
|
||||||
|
|
||||||
|
// Range based test
|
||||||
|
res = ba::partition_point ( v, comp );
|
||||||
|
exp = offset_to_iter ( v, expected );
|
||||||
|
std::cout << "Expected(3): " << std::distance ( v.begin (), exp )
|
||||||
|
<< ", got: " << std::distance ( v.begin (), res ) << std::endl;
|
||||||
|
BOOST_CHECK ( exp == res );
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
Reference in New Issue
Block a user