Boost logo

Boost :

From: Brian McNamara (lorgon_at_[hidden])
Date: 2004-04-07 20:26:20


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. One might want to use Lambda to generate
> such a functor, but without knowing its type it would be of limited use (of
> course one can directly specify the type of such functor, but this would be
> rather tedious).
>
> Has anything been done by anybody in this regard?

I don't know that Lambda has anything like this. FC++ does:

http://www.cc.gatech.edu/~yannis/fc++/boostpaper/fcpp.sectlambda.html#id270886

Perhaps if/when work on a new "FP core" built atop Fusion happens,
these considerations can be built in. In the meantime, it might not be
too difficult (though maybe a lot of "busy-work") to add this alongside
the existing Lambda implementation. I dunno enough about the specifics
to be sure, but Jaakko or Peter or Joel would probably know.

(And of course, as someone else mentioned, you can always use
Boost.Function if you are able/willing to add a layer of indirection and
"forget" the most specific type information.)

-- 
-Brian McNamara (lorgon_at_[hidden])

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