
I have just started with C++20. In one word, I am flabbergasted!
Though, I had just a glance, that was indeed an awe-inspiring session!
One can never complete learning C++, as they keep on adding new features every 3 years or so, with a new standard. I was sceptical about this at first. But, looking at the way they have improvised the language with C++20, I am forced to turn back on that pre-conception of mine. I refuse to use the word “prejudice thought” here. Please cut me some slack here. It will take time to welcome all these additions just like that. Let it take some time to bake-in and ready. I am pro-C++ 20 now! It seems like improvisation is a necessity of the modern programming language and problems that it tries to solve.
Now, let me mention some of the core C++20 features which is worth mentioning.
According to C++ 20 experts, the 4 core features includes concepts, co-routines, ranges, and modules.
They are looking forward to avoid header files through modules, minimalistic thread like yielding functions called coroutines, language support for “parameterized types” pre-requisites through concepts in templates etc. Concepts are more readable and intuitive than previous static_assert<>, that’s my opinion. Kindly excuse!
Python enthusiasts, just have a look at what C++20 has in its offerings.
They have literally made C++ more Pythonic. I don’t mean the way experts, a.k.a. Pythonistas, write Python code. Here, by “pythonic”, I am simply referring to the way, how C++ 20 is filled with features which could be found in Python already, and in abundance. Introducing view::filter, transform, pipelines!!! As an intermediate python programmer, I know that python has map() and filter() for the same purpose. Also, python’s yield feature. which is a kind of temporary suspension/or partial return from a function, is now realized in C++ 20 using coroutines. This is just another beautiful example, where we can see a very popular programming language such as python influencing another popular language such as C++. In olden days I have seen the way C++ influenced C and Java and even vice versa. But C++ becoming more python like? Well, that’s another story!!!!
Most of them are expecting “generators” in the next C++ standard!!! Python has generators from the beginning. Now they have added experimental generators in Microsoft Visual C++. (Reference: C++20: An (Almost) Complete Overview – Marc Gregoire – CppCon 2020)
To conclude, for the sake of, well, concluding, C++ is way too powerful now and quite elegant. I came to know that, the only compiler that support C++ 20 one hundred percent is Microsoft C++ compiler. Well done, Microsoft! Not sure on GCC. I heard version 10 supports C++20. Don’t know up to what extend??? But I’m pretty sure that it’s just a work in progress and is just a matter of time that we will see GCC and clang with full C++ 20 support!
Just for a quick reference: Please go through video titled: C++20: An (Almost) Complete Overview – Marc Gregoire – CppCon 2020.