Explicit passing "this" parameter to method call

c++, c++11, std

Solution

Here is an idea for a dispatcher which you could use inside your `bind`:

template <class R, class... Arg>
R call(R (*f)(Arg...), Arg &&... arg)
{ return f(std::forward<Arg>(arg)...); }

template <class C, class R, class... Arg>
R call(R (C::*f)(Arg...), C &c, Arg &&... arg)
{ return (c.*f)(std::forward<Arg>(arg)...); }

Problem

Is it possible in c++ call class method with explicit passing first "this" param to it? Something like this: ``` struct A { void some() {} }; .... A a; A::some(&a); // ~ a.some(); ``` For reasonable question "WHY?": i need to implement std::bind analogue, and it works fine with constructions like this: ``` void f(int); bind(f, 3); ``` but this doesn't work: ``` bind(&A::some, &a); ``` UPDATE: Guys, my question is obviously not really clear. I know how to use std::bind, i want to know HOW is it processing constructions where this param explicitly passed to it: std::bind(&A::some, &a);

Original source