|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r76407 - in sandbox/partition_point/boost: iterator partition_point
From: aschoedl_at_[hidden]
Date: 2012-01-11 01:29:42
Author: schoedl
Date: 2012-01-11 01:29:41 EST (Wed, 11 Jan 2012)
New Revision: 76407
URL: http://svn.boost.org/trac/boost/changeset/76407
Log:
support for lambdas
Text files modified:
sandbox/partition_point/boost/iterator/transform_partition_point.hpp | 2 +-
sandbox/partition_point/boost/partition_point/partition_algorithms.hpp | 6 +++---
sandbox/partition_point/boost/partition_point/partition_point.hpp | 4 +++-
3 files changed, 7 insertions(+), 5 deletions(-)
Modified: sandbox/partition_point/boost/iterator/transform_partition_point.hpp
==============================================================================
--- sandbox/partition_point/boost/iterator/transform_partition_point.hpp (original)
+++ sandbox/partition_point/boost/iterator/transform_partition_point.hpp 2012-01-11 01:29:41 EST (Wed, 11 Jan 2012)
@@ -20,7 +20,7 @@
partition_point(
itBegin.base(),
itEnd.base(),
- boost::bind( pred, boost::bind( itBegin.functor(), _1 ) )
+ boost::bind( pred, boost::bind<transform_iterator<UnaryFunc, Iterator>::reference>( itBegin.functor(), _1 ) )
),
itBegin.functor()
);
Modified: sandbox/partition_point/boost/partition_point/partition_algorithms.hpp
==============================================================================
--- sandbox/partition_point/boost/partition_point/partition_algorithms.hpp (original)
+++ sandbox/partition_point/boost/partition_point/partition_algorithms.hpp 2012-01-11 01:29:41 EST (Wed, 11 Jan 2012)
@@ -45,10 +45,10 @@
template< typename It, typename Val, typename BinPred >
std::pair<It,It> equal_range(It itBegin,It itEnd,Val const& x,BinPred pred) {
// Construct std::pair<It,It> initialized so that transform_iterator functor
- // does not have to be default-constructible. This is non-standard conformant,
+ // does have to be neither default-constructible nor assignable. This is non-standard conformant,
// but may be practical.
- itBegin=boost::lower_bound(itBegin,itEnd,x,pred);
- return std::pair<It,It>( itBegin, boost::upper_bound(itBegin,itEnd,x,pred) );
+ It itEqualBegin=boost::lower_bound(itBegin,itEnd,x,pred);
+ return std::pair<It,It>( itEqualBegin, boost::upper_bound(itEqualBegin,itEnd,x,pred) );
}
// According to http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#270
Modified: sandbox/partition_point/boost/partition_point/partition_point.hpp
==============================================================================
--- sandbox/partition_point/boost/partition_point/partition_point.hpp (original)
+++ sandbox/partition_point/boost/partition_point/partition_point.hpp 2012-01-11 01:29:41 EST (Wed, 11 Jan 2012)
@@ -21,7 +21,9 @@
It itMid = itBegin;
std::advance(itMid, nCount2);
if( pred(*itMid) ) {
- itBegin = ++itMid;
+ // work-around for functors which are not assignable, e.g., lambdas
+ itBegin.~It();
+ new (boost::addressof(itBegin)) It(++itMid);
nCount -= nCount2 + 1;
} else {
nCount = nCount2;
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk