
2011/10/12 Yanchenko Maxim <maximyanchenko@yandex.ru>
Hi,
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?
It doesn't seem all that onerous to insert a boost::mem_fn [1] in there (i.e., "transformed(boost::mem_fn(&Foo:::description))")...or does this not work? - Jeff [1] http://www.boost.org/doc/libs/1_47_0/libs/bind/mem_fn.html