Boost logo

Boost :

Subject: [boost] [range] adaptors and member functions pointers
From: Yanchenko Maxim (maximyanchenko_at_[hidden])
Date: 2011-10-12 07:14:27


While transforming and filtering sequences, it's pretty common to call the elements' member functions, so I think it's worth adding some syntactic sugar for range adaptors in order to achieve cleaner syntax.

E.g. if we have a class

struct Foo {
š std::string description() const;

and we want to get all non-empty descriptions, we could just write this clean code:

š foo_list | transformed(&Foo::description) | filtered(&std::string::size)

To enable this syntax, the attached patch should be applied to boost/range/adaptor/argument_fwd.hpp (diff against 1.47.0).

Is there any interest to add this to Boost.Range?


Boost list run by bdawes at, gregod at, cpdaniel at, john at