Jump to content
  • Advertisement
Sign in to follow this  
ZealousEngine

boost::bind/lambda question

This topic is 4084 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!