Making the constructor explicit
has nothing to do with the arguments having to match exactly! The affect of making a constructor explicit means that it won't be used to implicitly convert an object of a different type the type Bar
using this constructor. However, if you try to initialize a Bar
object using direct initialization (i.e., Bar(x)
), both constructors will be considered.
The result of std::bind()
is certainly not a std::function<Signature>
, i.e., it doesn't match either of your constructors exactly. Since there is a non-explicit
constructor for std::function<Signature>
which works for function objects, both signatures do match: the produced bind expression doesn't require any parameter but it can take arguments, i.e., any argument type also cannot be used to distinguish which of the two constructors of Bar
should match. Even if the bind expression would require one argument, I don't think it would be used to prefer one constructor over another.