boost::bind/lambda question
Im wondering, how do you create a new/local variable inside a boost::bind?
For example, how should something like this be written...
boost::bind((
int val;
val = boost::bind( &ObjectType::foo, &myObj )(),
boost::bind( &ObjectType::goo, &myObj, _1 )( val )
));
The goal is to get a function that looks like - foo(goo()). I know I COULD do this by nesting the binds, but nesting to many binds can get messy fast. I want to buffer the return values in local variables, to make things easier to read.
How can I do this?
Thanks!
boost::bind and boost::lambda get messy. If you don't want the mess, write a real function. That's also messy, but perhaps in a more acceptable way.
Im starting to think youre right..
I guess my original logic was all wrong. I shouldnt be trying to encapsulate complex blocks of code in a boost::bind (with the ultimate goal of sending them to another thread to be executed). I should just write the same complex block of code in a traditional function/object, and just send a call back request to the other thread.
I guess my original logic was all wrong. I shouldnt be trying to encapsulate complex blocks of code in a boost::bind (with the ultimate goal of sending them to another thread to be executed). I should just write the same complex block of code in a traditional function/object, and just send a call back request to the other thread.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement