Section: 22.214.171.124.1 [func.wrap.func.con] Status: New Submitter: Barry Revzin Opened: 2016-09-14 Last modified: 2016-10-12
View other active issues in [func.wrap.func.con].
View all other issues in [func.wrap.func.con].
View all issues with New status.
I think there's a minor defect in the std::function interface. The constructor template is:
template <class F> function(F f);
while the assignment operator template is
template <class F> function& operator=(F&& f);
The latter came about as a result of LWG 1288, but that one was dealing with a specific issue that wouldn't have affected the constructor. I think the constructor should also take f by forwarding reference, this saves a move in the lvalue/xvalue cases and is also just generally more consistent. Should just make sure that it's stored as std::decay_t<F> instead of F.Is there any reason to favor a by-value constructor over a forwarding-reference constructor?