#include <iostream>
#include <functional>
typedef int(*SumFptr)(int,int);
int main()
{
SumFptr ptr = nullptr;
std::function<int(int)> func = std::bind(ptr, std::placeholders::_1, 42);
std::cout << (func ? "true" : "false") << std::endl;
return 0;
}
The output is true. My expectation was false, like std::function{nullptr}. Is it a bug or correct behaviour, where can I read about it?
Aucun commentaire:
Enregistrer un commentaire