Boost logo

Boost Users :

Subject: [Boost-users] [Range] and [MemberFunction]
From: Robert Jones (robertgbjones_at_[hidden])
Date: 2012-03-13 10:29:18

In the documentation of Boost.MemberFunction it suggests that a useful
for it would be to implement overloads of std algorithms, and indeed other
algorithms such that the final callable parameter could be a simple pointer
to member.

struct X { bool method( ); };

std::vector<X> xs;

for_each( xs.begin( ), xs.end( ), & X::method );

or from Boost.Range

boost::for_each( xs, &X::method );

Is such a facility implemented anywhere in Boost?

Where I'm really going with this, is that I'd like to see versions of
Boost.Range adaptors which
support the same facility, so I can say, for example

for_each( xs | filtered( & X::method ), doSomething );

rather than, as at present,

for_each ( xs | filtered( bind( & X::method, _1 ) ), doSomething );

and similarly for transformed.


- Rob.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at