#include <functional>
#include <string>
using namespace std;
int main()
{
function<long(const string&, size_t, int)> fn = stol;
}
The code above cannot be compiled as expected with the following error:
error : no matching constructor for initialization of 'std::function<long (const std::string &, std::size_t, int)>' (aka 'function<long (const basic_string<char, char_traits<char>, allocator<char> > &, unsigned long long, int)>')
std::stol
reference should be helpful. Note the arguments, and compare them with yours. – Some programmer dudestd::stol()
is asize_t*
pointer, not asize_t
value like you have it. – Remy Lebeau