Boost logo

Boost :

From: Shannon Stewman (stew_at_[hidden])
Date: 2004-04-07 20:05:45


On Wed, Apr 07, 2004 at 08:59:42PM -0400, Arkadiy Vertleyb wrote:

> I am wonderring if there is an easy way to determine the type of a lambda
> functor, kind of lambda-specific typeof facility. I do realize that the
> primary purpose of lambda is to create temporary functors to pass to STL
> algorithms.

> On the other hand, there are contexts where functors need to be
> stored, such as in std::set, etc.

I assume you mean for the comparator, not storing a set of functors.

> Has anything been done by anybody in this regard?

I've often used Boost.Function for this, though I'm interested in
approaches that don't involve the function-pointer-like overhead:

  typedef Some_Type SetElementType;
  typedef boost::function< bool (const SetElementType&
                           , const SetElementType&) >
    SetElementComparator;
  typedef std::set< SetElementType, SetElementComparator > SetType;

Best,

-- 
Shannon Stewman         | Let us walk through the waning night,
Caught in a whirlpool,  | As dawn-rays tickle our toes, the dew soothes
A quartering act:       | Our blistered soles, and damp bones stir
Solitude or society?    | As crimson cracks under the blue-grey sky.

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