Continuing this thread I'd like to split it off into another more specific question. I want to bind a function using ChaiScript, and I can do that using std::function
, but I can't seem to let std::function
know which overload it should use.
Mirroring relevant methods:
class DLLExport Actor
{
public:
Actor(Level* level, const String& name, Actor* parent);
virtual ~Actor();
void setPosition(const Real& x, const Real& y, const Real& z);
void setPosition(const Vector3& position);
};
and then I'm trying to bind it like so:
std::function<void(Actor*, Vector3&)> setPos = &Actor::setPosition; // <-- C2440 here.
m->add(fun(setPos), "setPosition");
What I'm getting is the following error:
2>..\..\ScriptingDemo\Binder.cpp(63): error C2440: 'initializing' : cannot convert from 'overloaded-function' to 'std::function<void (Actor *, Vector3 &)>'
2> No constructor could take the source type, or constructor overload resolution was ambiguous