To figure out the problem let separate statements:
auto f = bind(&TestA::testa, &testA, _1, _2); // OK test.setCallback(f); // <<--- Error is here
setCallback
needs to know type of T
and it can’t deduce it from f
, so give it a type
test.setCallback<TYPE>(f); // TYPE: int, float, a class, ...
Related Posts:
- c++ –
- C++ — expected primary-expression before ‘ ‘
- Return array in a function
- Meaning of = delete after function declaration
- Officially, what is typename for?
- Argument list for class template is missing
- What does “missing template argument” mean?
- invalid use of non-static member function
- Reverse Contents in Array
- c++: No instance of overloaded function
- error: expected primary-expression before ‘)’ token (C)
- What does “missing template argument” mean?
- Difference of keywords ‘typename’ and ‘class’ in templates?
- error: “initializer expression list treated as compound expression”
- Getting error: ISO C++ forbids declaration of with no type
- “Implicit instantiation of undefined template” when forward declaring template class
- “used without template parameters”
- C++ template constructor
- Function for C++ struct
- error C2106: ‘=’ : left operand must be l-value
- use of class template requires template argument list
- What does it mean that “a declaration shadows a parameter”?
- C++ – statement cannot resolve address for overloaded function
- How do I return a char array from a function?
- How to return a struct from a function in C++?
- Why can’t we pass arrays to function by value?
- C++ Templates – LinkedList
- C++ template – error: expected initializer before ‘<' token
- Class template inheritance C++
- got “cannot appear in a constant-expression” when using template
- In C++ what does template<> mean?
- non-member function cannot have cv-qualifier
- How can I add reflection to a C++ application?
- ERROR: Control may reach end of non-void function /
- function does not take 1 arguments c++
- Unrecognizable template declaration/definition
- C++ correct way to return pointer to array from function
- error C2244 unable to match function definition to an existing declaration
- error C2995: function template has already been defined
- Difference between function arguments declared with & and * in C++
- Is C++ Array passed by reference or by pointer?
- “cannot be used as a function error”
- invalid use of template name without an argument list
- Struct with template variables in C++
- Here is some error with my .h file which show [Error] unterminated #ifndef when I include my class template in it
- Template constructor in a class template – how to explicitly specify template argument for the 2nd parameter?
- Why is “using namespace std;” considered bad practice?
- What is a lambda expression in C++11?
- How to convert string to char array in C++?
- ld: symbol(s) not found for architecture x86_64 error
- C++ string to double conversion
- How do I print out the contents of a vector?
- Is there a C++ decompiler?
- What is a dangling pointer?
- undefined reference to WinMain@16 (codeblocks)
- Why use ‘glad’ library for opengl initialization? [duplicate]
- What does `*&` in a function declaration mean?
- (->) arrow operator and (.) dot operator , class pointer
- How to reverse an std::string? [duplicate]
- Why am I getting this redefinition of class error?
- error: redefinition of class
- How to convert a std::string to const char* or char*
- What is the difference between a static and const variable?
- What is move semantics?
- Why doesn’t std::vector::push_front() exist?
- Fastest way to check if a file exist using standard C++/C++11,14,17/C?
- Invalid use of non-static member function c++
- C++ #include guards
- Is std::stoi actually safe to use?
- C++ forbids variable-size array
- Fill array with random numbers within a specified range (C++)
- Remove an array element and shift the remaining ones
- Right way to split an std::string into a vector
- string subscript out of range error
- push_back vs emplace_back
- Already defined in .obj – no double inclusions
- expected unqualified-id before string constant
- C++: Access violation writing location
- error: strcpy was not declared in this scope
- how to print a string to console in c++
- How to call a parent class function from derived class function?
- C++ – include unistd.h: why not cunistd?
- Dynamically allocated string array, then change it’s value?
- Use the auto keyword in C++ STL
- stoi function gives error: std::invalid_argument at memory location 0x0035E8D8. c++
- Stack around the variable ‘ ‘ was corrupted
- The difference between cin.ignore and cin.sync
- casting int to char using C++ style casting
- How to print (using cout) a number in binary form?
- What is the job of autogen.sh when building a c++ package on Linux
- MSVCP120d.dll missing
- Modulo operator with negative values [duplicate]
- Finding the type of an object in C++
- C++ Simple Dice roll – how to return multiple different random numbers [duplicate]
- How can I get a file’s size in C++?
- Why can’t I make a vector of references?
- What does “-Wall” in “g++ -Wall test.cpp -o test” do?
- error: no member function declared in class
- Why does my program give “NULL used in arithmetic”
- no matching function to call for “getline”