Reputation: 24039
The return type of boost::bind
and now std::bind
is unspecified.
What is the return type of boost::bind?
Why is it that the return type of boost::bind
and now std::bind
is unspecified? Why isn't it something like boost::function
and std::function
?
I realize that the intent is to refer to the return type via type deduction but that doesn't answer why std::bind
is special.
If that was just the whim of the committee then ok, there's not much else to say, but is there a technical reason that specifying a return type for std::bind
is uniquely burdensome or that not specifying it permits a more efficient implementation?
Upvotes: 1
Views: 1005
Reputation: 4853
It isn't boost::function or std::function because those both perform type erasure, which may need a memory allocation (bind does not) and typically cannot have the function call inlined.
Upvotes: 0
Reputation: 283614
Well, for starters there isn't just one return type. It varies greatly depending on the types of the arguments passed in.
The C++ Standard is leaving a lot of flexibility to implementers exactly how different cases are broken out (using overloading and SFINAE) and mapped onto different closure object types.
Upvotes: 5