From b9d91c59e41e349c390dc3d7df43baf6b7e34c4e Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Wed, 18 Jun 2014 19:16:34 +0200 Subject: [PATCH] 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. --- include/boost/algorithm/cxx11/partition_point.hpp | 2 +- test/partition_point_test1.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/boost/algorithm/cxx11/partition_point.hpp b/include/boost/algorithm/cxx11/partition_point.hpp index 36d8384..9f0b972 100644 --- a/include/boost/algorithm/cxx11/partition_point.hpp +++ b/include/boost/algorithm/cxx11/partition_point.hpp @@ -61,7 +61,7 @@ ForwardIterator partition_point ( ForwardIterator first, ForwardIterator last, P /// \param p The predicate to test the values with /// template -typename boost::range_iterator partition_point ( Range &r, Predicate p ) +typename boost::range_iterator::type partition_point ( Range &r, Predicate p ) { return boost::algorithm::partition_point (boost::begin(r), boost::end(r), p); } diff --git a/test/partition_point_test1.cpp b/test/partition_point_test1.cpp index 95f6058..3d66770 100644 --- a/test/partition_point_test1.cpp +++ b/test/partition_point_test1.cpp @@ -54,6 +54,13 @@ void test_sequence ( Container &v, Predicate comp, int expected ) { std::cout << "Expected(2): " << std::distance ( v.begin (), exp ) << ", got: " << std::distance ( v.begin (), res ) << std::endl; 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