std::bind question...

On msvc2013 I can do this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class c
{

void member_function(int x)
{
std::cout << x;
}

void test()
{
std::function<void(int)> fn = std::bind(&c::member_function, this, _1);
fn(123);
}

};

...but I can't do this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class c
{

void member_function(int x, int y)
{
std::cout << x;
}

void test()
{
std::function<void(int,int)> fn = std::bind(&c::member_function, this, _1);
fn(123,456);
}

};

??? Error is:

Error 1 error C2064: term does not evaluate to a function taking 2 arguments
Last edited on
Topic archived. No new replies allowed.