I’m using boost::function for making function-references:
typedef boost::function<void (SomeClass &handle)> Ref;
someFunc(Ref &pointer) {/*...*/}
void Foo(SomeClass &handle) {/*...*/}
What is the best way to pass Foo into the someFunc?
I tried something like:
someFunc(Ref(Foo));
In order to pass a temporary object to the function, it must take the argument either by value or by constant reference. Non-constant references to temporary objects aren’t allowed. So either of the following should work:
By the way, calling the type
Refand the instancepointerwhen it’s neither a reference nor a pointer could be a bit confusing.