Boost logo

Boost Users :

Subject: Re: [Boost-users] [Range] and [MemberFunction]
From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2012-03-13 11:05:41


On Tue, Mar 13, 2012 at 3:29 PM, Robert Jones <robertgbjones_at_[hidden]>wrote:

> In the documentation of Boost.MemberFunction it suggests that a useful
> purpose
> for it would be to implement overloads of std algorithms, and indeed other
> similar
> 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.
>
> Thanks,
>
> - Rob.
>

What about Boost.Foreach???
http://www.boost.org/doc/libs/1_49_0/doc/html/foreach.html

Regards,
ovanes



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net