Boost logo

Boost :

From: Jens Maurer (Jens.Maurer_at_[hidden])
Date: 2001-02-12 14:54:13


Shankar Sai wrote:
> Is there any interest in a library that would enable member variables
> to be used with the STL algorithms without having to write trivial
> functions? In case I'm not being clear <g>, here's an example.

You have been advised of the lambda calculus libraries floating around.
However, I believe there may be a need for simple adapters such as the
one you propose for non-conforming compilers or minimizing compile time.

Please have a look at the function object and compose adapters already
present in boost for design guidance.

http://www.boost.org/libs/functional/index.html
http://www.boost.org/libs/compose/index.htm

It seems that the adapter compose_f_gx_hx probably does most of what
you want, so you may only need some functional wrapper around for
a data member.

> template <class T, class Member, class Comp>
> struct member_comparer : public std::binary_function <T, T, bool>

This interface does not seem flexible enough for the general case.
Don't you simply want some data_member<> template which just wraps
the member pointer?

Jens Maurer


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk