Isn’t the template argument (the signature) of std::function part of its type?
The problem is that both function<int()> and function<int(int)> are constructible from the same function. This is what the constructor declaration of std::function looks like in VS2010: template<class _Fx> function(_Fx _Func, typename _Not_integral<!_Is_integral<_Fx>::value, int>::_Type = 0); Ignoring the SFINAE part, it is constructible from pretty much anything. std::/boost::function employ a technique called type erasure, to allow … Read more