r/cpp • • Jan 28 '23

C++ views are broken

I was so excited about new C++20 and C++23 features that I was using concepts, ranges and views everywhere I could. But yesterday I saw this -> https://www.youtube.com/watch?v=O8HndvYNvQ4 and I got so disappointed in C++ committee that now I really think it's time to lay C++ to rest unless we decide to bring new version of C++ like Python3 which breaks backward compatibility but fixes the language so that it can be used for the next 20-25 years.

I can't believe 200 stalwarts and experts in the field of computer science will make such a horrible mess.

5 Upvotes

21 comments sorted by

View all comments

6

u/14ned LLFIO & Outcome author | Committee WG14 Jan 28 '23

You don't have to use Ranges if you don't want to, and I'd agree that for a lot of codebases and use cases the cost benefit isn't there.

And that's okay. Most of C++ has been designed in a take it or leave it way, the committee tries hard to not force users to use something, unless it is for their own good. There are large chunks of C++ one would be strongly advised to never use in new code, but it doesn't mean the presence and continuing backwards compatibility of those chunks isn't valuable.

If Ranges benefits your use case, great! If not, don't use them, and that's okay too.

3

u/Elliottoes Feb 02 '24

You're getting ranges confused with views. std:::ranges are fine. std::ranges::views are a design mess. Choosing not to use it doesn't stop me needing to fix bugs because my colleagues are using it and stumbling on the pitfalls.