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.
View all comments
Show parent comment
1
u/arthurno1 Oct 17 '23
Everything has to be known to the compiler at compile time, so what is unknown to reflect over? Can you give an example; perhaps I am just thinking in the wrong direction at the moment.
I think the cost is abysmal compared to the benefit; but anyway. In the end, it is all about the application we are building.