Skip to content

Commit 1de6a21

Browse files
committed
Fix transform_iterator nonconformance
[SVN r14114]
1 parent 43d8c81 commit 1de6a21

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

test/input_iterator.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,26 @@
88
#include <boost/python/iterator.hpp>
99
#include <boost/iterator_adaptors.hpp>
1010
#include <list>
11-
#include <utility>
12-
#include <iterator>
13-
#include <functional>
1411

1512
using namespace boost::python;
1613

1714
typedef std::list<int> list_int;
1815

19-
// Prove that we can handle InputIterators which return rvalues. This
20-
// input iterator example was stolen from the iterator_adaptors
21-
// documentation
22-
typedef std::binder1st<std::multiplies<int> > doubler;
16+
// Prove that we can handle InputIterators which return rvalues.
17+
struct doubler
18+
{
19+
typedef int result_type;
20+
int operator()(int x) const { return x * 2; }
21+
};
22+
2323
typedef boost::transform_iterator_generator<doubler, list_int::iterator>::type doubling_iterator;
2424
typedef std::pair<doubling_iterator,doubling_iterator> list_range2;
25+
2526
list_range2 range2(list_int& x)
2627
{
2728
return list_range2(
28-
boost::make_transform_iterator<doubler>(x.begin(), std::bind1st(std::multiplies<int>(),2))
29-
, boost::make_transform_iterator<doubler>(x.end(), std::bind1st(std::multiplies<int>(),2)));
29+
boost::make_transform_iterator<doubler>(x.begin(), doubler())
30+
, boost::make_transform_iterator<doubler>(x.end(), doubler()));
3031
}
3132

3233
// We do this in a separate module from iterators_ext (iterators.cpp)

0 commit comments

Comments
 (0)