
On Thu, Mar 13, 2008 at 1:32 PM, Robert Dailey <rcdailey@gmail.com> wrote:
On Thu, Mar 13, 2008 at 1:03 PM, vicente.botet <vicente.botet@wanadoo.fr> wrote:
This will not work because of this line in bind_mem_fn.hpp:
#include <boost/function_types/function_arity.hpp>
function_types is not in 1.34.1 :(
Why you don't take also this file is this could help you ;-)? You can get it from the trunk.
Because, like with all other boost library components, I'm afraid of cherry picking files because they are usually involved in a large web of dependencies. More than likely I won't be just taking one file, I'll be taking many files and doing a lot of manual hunting. Even if I get all the files, there might also be compatibility issues when taking Boost 1.35files and placing them in boost 1.34.1. I would rather not have to wait for subtle issues to arrive.
I was actually able to get this working, surprisingly enough. I copied over function_types into boost 1.34.1 and at the very least bind_mem_fn seems to work. However, I'm having a bit of an issue with my design that uses bind_mem_fn. Right now I have a class that has a boost::tuple of objects which, on construction, bind a function to a boost::signal. In my constructor, I fill the tuple with various references to member functions of the class initializing the tuple. For example: using boost::dataflow::utility::bind_mem_fn; Rocket_Input::Rocket_Input() : m_subscriptions( bind_mem_fn( &Rocket_Input::HandleKey, this ), bind_mem_fn( &Rocket_Input::HandleMouseMotion, this ), bind_mem_fn( &Rocket_Input::HandleMouseWheel, this ), bind_mem_fn( &Rocket_Input::HandleMouseButton, this ) ) {} While this does compile, it will crash any time that one of the function objects is called because in the initializer list, 'this' references a NULL pointer when the class object was allocated on the heap via a call to 'new'. Is there a way I can initialize my tuple so that 'this' will be a valid pointer? For now, I might just go ahead and make my m_subscriptions tuple a boost::scoped_ptr and initialize it in the constructor body and see if that helps. Thanks.