Boost logo

Boost Users :

From: Johan Nilsson (r.johan.nilsson_at_[hidden])
Date: 2007-05-30 05:12:59


Hi,

does a return statement wrapper exist in Boost.Lambda? I'd like to be able
to do something conceptually similar to the following:

--
#include <boost/lambda/bind.hpp>
#include <boost/lambda/lambda.hpp>
#include <cassert>
namespace lambda = boost::lambda;
void bar(int)
{
    // whatever
}
void foo()
{
    int const shouldBe3 = (
        lambda::bind(&bar, 1),
        lambda::bind(&bar, 2),
        lambda::return(3) // Yes, this conflicts with the regular "return" 
statement, but you get the idea
    )();
    assert(3 == shouldBe3);
}
---
I know I can roll my own implementation or work around it, but I was just 
wondering if something like that already exists. Couldn't locate anything in 
the docs - did I miss something?
/ Johan

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net