Last week, I launched a quiz. The price was it to win one of the five vouchers for the book "The Modern C++ Programming Cookbook" 2en Edition by Marius Bancila.
The challenge to win one of the five coupons was it to answer the following question: "What is your favorite C++ feature and why?.
Without further ado, here are the winners and there answers:
- Samuel Burch
- José Braga
- Idriss Chaouch
- Daniel Garcia
That’s pretty clear for me: ranges (and views). Not only is every STL container with C++20 automatically a range, but also do views allow a clean and pretty simple syntactic concatenation of operations to generate a new collection of desired items. Also one is very flexible by using lambdas in those filter operations. This has the [the] benefit of not having to rely on a fixed set of predefined operations.
My favorite C++20 feature is : std:: source_location because it helps to understand where method was called or where exception was thrown. Other features are important too but it will be difficult to apply for big old projects and some features [can] be replaced external libraries, for example std:format -> fmt: format . Of course concepts and modules have big impact to C++ but it needs knowledge sharing between team members.
I am in a company still attached to C++14. Using legacy C++ standards has been my professional experience ever since I became a C++ programmer 10y ago. I still remember fondly how Alien [this reference is important later on :)] it felt to program in C++11 and the excitement of going through the code to update the codebase to the new standard.
In my personal projects, I took full advantage of several C++17 features but the transition was easier, more familiar - It was a step forward, not a parkour ride.
Although daunting, going through a language overhaul is really exciting, filled with opportunities to learn and to expand the way we solve problems - sometimes also the way we think about our challenges.
So, going through examples with Ranges is akin to jumping in the Nostromo to help Signourney Weaver fight off the ugly creature. Also it does not hurt that it borrows bash pipe -- definitely my favorite :)
I really appreciate the concepts library defining in the header file. I’m a big fan of creating new types using behaviour at compile time.
Concepts introduce more flexibility to generic programming. Now it is possible to set restrictions on template parameters, check for constraints, and discover incompatible behaviour at compile time. Before this big feature introduced by C++20, we used Templates (and we still use Templates in some contexts), but Templates don’t only provide abstraction from the specific type, but also incorporate loose coupling between the entity and aggregate types.
Templates use the keyword "template", Concepts go more further, they allow replacing it with a type description that describes the template parameter. If the type doesn’t satisfy the constraint, the compiler will then throw an error.
Concepts rely essentially on constraints. A constraint is a way to specify requirements for template arguments, and a concept is a set of constraints. We can also combine many concepts into one to get a new concept.
We can also find some more strength provided by the Concepts library like the atomic constraint, constraint normalization, etc..
My favourite C++20 feature is concepts. They remove many obscure idioms usually involving SFINAE and enable_if. That is great! Sometimes (not always) they make error messages easier to understand. That is a nice side effect. But those are not the real reasons.
The reason why I love concepts so much is that they make it easy to express programmers intent in a meaningful way. I can express generic code and non-generic code much more in the same way. And I can teach generic programming in a way that is meaningful to much more people.
Congratulations to all Winners. I give Packt your e-mail address and they will contact you.
Thanks a lot to my Patreon Supporters: Matt Braun, Roman Postanciuc, Tobias Zindl, Marko, G Prvulovic, Reinhold Dröge, Abernitzke, Frank Grimm, Sakib, Broeserl, António Pina, Sergey Agafyin, Андрей Бурмистров, Jake, GS, Lawton Shoemake, Animus24, Jozo Leko, John Breland, espkk, Wolfgang Gärtner, Louis St-Amour, Venkat Nandam, Jose Francisco, Douglas Tinkham, Kuchlong Kuchlong, Robert Blanch, Truels Wissneth, Kris Kafka, Mario Luoni, Neil Wang, Friedrich Huber, lennonli, Pramod Tikare Muralidhara, Peter Ware, Tobi Heideman, Daniel Hufschläger, Red Trip, Alexander Schwarz, Tornike Porchxidze, Alessandro Pezzato, and Evangelos Denaxas.
Thanks in particular to Jon Hess, Lakshman, Christian Wittenhorst, Sherhy Pyton, Dendi Suhubdy, Sudhakar Belagurusamy, and Richard Sargeant.
My special thanks to Embarcadero
I'm happy to give online-seminars or face-to-face seminars world-wide. Please call me if you have any questions.
Standard Seminars (English/German)
Here is a compilation of my standard seminars. These seminars are only meant to give you a first orientation.
- Phone: +49 152 31965939
- German Seminar Page: www.ModernesCpp.de
- English Seminar Page: www.ModernesCpp.net