schuess
schuess

Reputation: 1069

boost::bind method with non constant arguments

I'm trying to bind a boost method that has an argument list, but I want to specify the value of the arguments when I emit the signal, not as a constant when binding.

boost::bind( &myClass::myMethod, this, _1 ) );

My understanding is the _1 means to hold a place for an argument, but let me specify it at call time. This gives me a compile error saying that _1 an undeclared identifier and when I use a constant then specify an argument at call time, the constant is used.

The boost manual talks about doing this _1 with functions (as opposed to methods) - is there a way to do this with methods?

Thanks in advance

Upvotes: 2

Views: 276

Answers (1)

Puppy
Puppy

Reputation: 146998

You probably forgot the namespace qualification- _1 is an object, and it's lookup must be qualified.

Upvotes: 0

Related Questions