C
Caleb
I have a class that has two member functions of the same name:
class MyClass {
public:
void someFunction(int arg);
void someFunction(int arg, char blah);
};
I'm trying to get a tr1::functional to the first one, for example:
std::tr1::function<void (MyClass*, int)> func_obj;
func_obj = &Myclass::someFunction;
But compilation fails on the second line, since MyClass::someFunction
is ambiguous.
The only way around it I've found is to first create a member function
pointer, then pass that to the constructor of the function object.
I'm curious if there's a better way to do it, or if I'm stuck with
using function pointers as intermediates? I'm using linux gcc 4.1.
Thanks,
Caleb
class MyClass {
public:
void someFunction(int arg);
void someFunction(int arg, char blah);
};
I'm trying to get a tr1::functional to the first one, for example:
std::tr1::function<void (MyClass*, int)> func_obj;
func_obj = &Myclass::someFunction;
But compilation fails on the second line, since MyClass::someFunction
is ambiguous.
The only way around it I've found is to first create a member function
pointer, then pass that to the constructor of the function object.
I'm curious if there's a better way to do it, or if I'm stuck with
using function pointers as intermediates? I'm using linux gcc 4.1.
Thanks,
Caleb