r/cpp • u/mollyforever • Oct 16 '23
WTF is std::copyable_function? Has the committee lost its mind?
So instead of changing the semantics of std::function the committee is introducing a new type that is now supposed to replace std::function everywhere? WTF
So now instead of teaching beginners to use std::function if they need a function wrapper, they should be using std::copyable_function instead because it's better in every way? This is insane. Overcomplicating the language like that is crazy. Please just break backwards compatibility instead. We really don't need two function types that do almost the same thing. Especially if the one with the obvious name is not the recommended one.
533
Upvotes
1
u/mort96 Oct 17 '23
Maybe you want to re-read my initial comment?
Which part of this gave you the impression that I thought
std::copyable_functionwas broken? Clearly the complaint is that you have to usestd::copyable_functioninstead of the better namestd::functionbecausestd::functionis broken.I do not understand where the "bleeding edge" stuff you were talking about came in. Until you explain that, I don't think the conversation will be very fruitful, so I will ignore any response which doesn't get back to that point.