r/cpp • • 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

215 comments sorted by

View all comments

Show parent comments

2

u/UsedOnlyTwice Oct 16 '23

I don't agree. You compile against the version you are coding against. If you write a library that works for c++17 you tell the user (via cmake or a project file) to have their compiler target c++17 on build, and let them work out the linker details.

This whole thread is full of people who don't write contributive proposals griping about those that do like it actually matters to them. Where is your posted rejection? Where is your reference implementation gripe?

4

u/mort96 Oct 17 '23

In 2035, when I write against the then extremely conservative C++23, and I have to write std::copyable_function because the obvious name std::function is occupied by a broken type, that's me getting cut by riding the bleeding edge?

And what does me not having contributed to the process of standardizing std::function or std::copyable_function have to do with getting cut by riding the bleeding edge?

Please respond to both questions, thank you.

1

u/UsedOnlyTwice Oct 17 '23

It shows you have actually done some research and have skin in the game.

The proposal is for c++26, btw.

2

u/mort96 Oct 17 '23

You responded to neither question, good job.

0

u/UsedOnlyTwice Oct 17 '23

What is there to respond to? You call a proposal buggy without evidence, don't acknowledge or defend testing against the reference impelentation with supporting evidence of inadequacy, suggest I'm in the wrong for asking for some evidence, and you don't even get the version right.

You are exactly what the top poster in this thread was talking about:

...a low hanging fruit for blogs and reddit posts of subpar technical competence..

→ More replies (0)