I've written the following class:
class SomeClass {
private:
void test_function(int a, size_t & b, const int & c) {
b = a + reinterpret_cast<size_t>(&c);
}
public:
SomeClass() {
int a = 17;
size_t b = 0;
int c = 42;
auto test = std::bind(&SomeClass::test_function, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);
test(a, b, c);
}
}
On its own, this code looks fine in the IDE (Visual Studio 2015) but when I try to compile it, I get the following errors:
Error C2893 Failed to specialize function template 'unknown-type std::invoke(_Callable &&,_Types &&...)' Basic Server C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\type_traits 1441
Error C2672 'std::invoke': no matching overloaded function found Basic Server C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\type_traits 1441
What am I doing wrong?
EDIT: I also wrote this version:
class SomeClass {
private:
void test_function(int a, size_t & b, const int & c) {
b = a + reinterpret_cast<size_t>(&c);
}
public:
SomeClass() {
int a = 17;
size_t b = 0;
int c = 42;
auto test = std::bind(&SomeClass::test_function, a, std::placeholders::_1, std::placeholders::_2);
test(b, c);
}
}
I get the exact same errors.