boost-lambda

boost lambda versus phoenix

hello. I recently started looking at boost phoenix, as replacement for lambda. Is phoenix a full replacement for lambda, or is there some lambda functionality which is not provided by phoenix? is phoenix mature? Are there any gotcha I should know about? my primary interest are operator composition, control statements and casts are les...

C++ boost::lambda::ret equivalent in phoenix

hello. Boost lambda allows to overwrite deduced return type using ret<T> template. I have tried searching for equivalent in phoenix but could not find one. Is there an equivalent in phoenix? I know how to make my own Replacement but I would rather not. thank you ...

How to use a phoenix expression with boost::transform_iterator?

<Update> As usual for me, the question was a wrong one. The actual question is: why doesn't transform_iterator use the conventional result_of<> metafunction to determine the return type, instead of accessing UnaryFunc::result_type directly. Posted an answer with a work around. </Update> Specifically, is there a way to make a phoenix ...

return statement in lambda expression

Hi All I created a lambda expression inside my std::for_each call. In it there is code like this one, but I have building error telling me that error: expected primary-expression before ‘return’ error: expected `]' before ‘return’ In my head I think that boost-lambda works mainly with functors, so since return statement it isn't li...

Copy map to vector

I have to copy certain elements from a std::map into a vector. It should work like in this loop: typedef int First; typedef void* Second; std::map<First, Second> map; // fill map std::vector<Second> mVec; for (std::map<First, Second>::const_iterator it = map.begin(); it != map.end(); ++it) { if (it->first % 2 == 0) { mVec.pu...

lambda bind problem?

Hello, I am a new beginner with boost. And here is my test code, using namespace boost::lambda; std::vector<std::string> strings; strings.push_back("Boost"); strings.push_back("C++"); strings.push_back("Libraries"); std::vector<int> sizes; std::for_each( strings.begin(), strings.end(), bind( &std::vector<...