3 ms·
This article might seem confusing. That's because it is. There is hardly a paragraph in it that is wholly correct, where they actually mean anything. C++ itse
by ncmncm 7y ago
This article might seem confusing.
That's because it is. There is hardly a paragraph in it that is wholly correct, where they actually mean anything.
C++ itself is much easier to understand than the article.
The real purpose for all the constexpr-related apparatus, as well as much of Concepts, is to make it much rarer that anybody needs to do "template metaprogramming". Instead of writing Template Metaprograms to run at compile time (a very strange functional pattern-matching language practically nothing like C++) you can usually write ordinary C++ code.
Coroutines are a new flow control primitive showing up in lots of languages lately. The C++ version is the same as the others.
The main benefit you will see from Concepts is overwhelmingly better error messages when you misuse a library component, whether Standard or your own.
Modules is a big step toward enabling a modern build infrastructure, as already seen in lots of newer languages that got benefit of hindsight.
All the old stuff is still there, because billions of lines of old code still use it. You don't have to use it in new code, but it all still works.
The biggest difference between old and new C++ code is that good new code uses value types more, and reference types less, making everything safer.
Coding modern C++ is overwhelmingly more fun than coding C++98 was, but it is just as fast as ever, and better than ever for writing fast, powerful, nice-to-use, no-compromise libraries.
- hackandtrip 7y agoI got had to fight with template metaprogramming lately, and I can't be happier than reading about this. Do you have any sources when one can learn in a non-confusing way about this new stuff, especially Concepts?
- favorited 7y agoIf you're looking for a high-level example, the Wikipedia article one where a function is constrained to only accept an argument which implements operators "==" and "!=". https://en.wikipedia.org/wiki/Concepts_(C%2B%2B) https://en.wikipedia.org/wiki/Concepts_(C%2B%2B)