Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::lambda questions
From: Michael Caisse (boost_at_[hidden])
Date: 2009-12-09 17:49:40

Peter Foelsche wrote:
> I would like to be able to:
> * return multiple results from a lambda function
> * use temporary variables inside a lambda function, declared using
> * I would need the ability to deduce the type of the returned values
> via BOOST_AUTO to declare the matching variables.
> I think I could use boost::tuple for this:
> const BOOST_AUTO(sTupleVar, someThing);
> const BOOST_AUTO(sFirstResult, get<0>(sTupleVar));
> const BOOST_AUTO(sSecond, get<1>(sTupleVar));
> But how to declare a local variable inside a lambda function?
> Peter

Hi Peter -

I would recommend taking a look at the Phoenix library. It is
more feature rich that Boost.Lambda.

For local variables see here:

There are multiple methods for dealing with fusion
sequences (tuples on steroids). You should find
everything you need with Boost.Phoenix. It also
has the upside of being more readable (imho).


Michael Caisse
Object Modeling Designs

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at