C++20: An (Almost) Complete Overview - Marc Gregoire - CppCon 2020

Поділитися
Вставка
  • Опубліковано 2 лип 2024
  • cppcon.org/
    github.com/CppCon/CppCon2020
    ---
    The technical work on C++20 was finished in January 2020, and is now being pushed through ISO certification.
    This presentation gives an overview of (almost) all new features in both the language and the Standard Library. Some more exotic features will be left out. New language features include modules, coroutines, concepts, templated lambdas, constexpr changes, designated initializers, the spaceship operator, string literals as template parameters, feature test macros, conditional explicit, immediate functions, and more.
    The second part of the session discusses the changes to the Standard Library. This includes topics such as ranges, atomic smart pointers, cancellable threads, a synchronization library, calendars, time zones, span, a formatting library, features test macros, and more.
    The material is mostly the same as the "C++20: What's in it for you?" session from CppCon 2019, but it has been updated with the final standard. If you want a complete overview of all C++20 features, including references to other more deep-dive sessions at CppCon 2020 on certain topics, then this session is for you.
    ---
    Marc Gregoire is a software architect from Belgium. He worked 6 years as a consultant for Siemens and Nokia Siemens Networks on critical 2G and 3G software running on Solaris for telecom operators. This required working in international teams stretching from South America and the United States to Europe, the Middle East, Africa, and Asia. Now, Marc is a software architect at Nikon Metrology (www.nikonmetrology.com), a division of Nikon and a leading provider of precision optical instruments, X-ray machines, and metrology solutions for X-ray, CT, and 3D geometric inspection.
    His main expertise is C/C++, specifically Microsoft VC++ and the MFC framework. He has experience in developing C++ programs running 24/7 on Windows and Linux platforms: for example, KNX/EIB home automation software. In addition to C/C++, Marc also likes C#.
    Since April 2007, he has received the annual Microsoft MVP (Most Valuable Professional) award for his Visual C++ expertise.
    Marc is the founder of the Belgian C++ Users Group (www.becpp.org), author of “Professional C++” 2nd, 3rd, and 4th Editions (Wiley/Wrox), co-author of “C++ Standard Library Quick Reference” 1st and 2nd Editions (Apress), technical editor for numerous books for several publishers, and regular speaker at the CppCon C++ conference. He maintains a blog at www.nuonsoft.com/blog/, and is passionate about traveling and gastronomic restaurants.
    ---
    Streamed & Edited by Digital Medium Ltd - events.digital-medium.co.uk
    events@digital-medium.co.uk
    *-----*
    *--*
    *-----*
  • Наука та технологія

КОМЕНТАРІ • 97

  • @ChrisCarlos64
    @ChrisCarlos64 3 роки тому +97

    Time Stamps
    -----------
    2:46 - New Keywords
    3:56 - Modules
    9:03 - Ranges
    15:00 - Coroutines
    18:57 - Concepts
    23:54 - Lambda Expression Changes
    26:47 - constexpr Changes
    27:54 - Concurrency Changes
    33:33 - C++20 Synchronization Library
    36:01 - Many more new features...
    42:06 - Calendars & Timezones
    45:27 - std::span
    47:30 - Feature Testing Macros
    48:36 - Version
    49:12 - Immediate Functions - consteval
    50:24 - constinit
    51:19 - Class Enums and using Directive
    52:07 - Text Formatting (std::format)
    54:11 - Math Constants
    54:31 - std::source_location
    55:31 - [[nodiscard(reason)]]
    55:51 - Bit Operations
    56:34 - Small Standard Library Additions
    Thanks for that informative video!

  • @Feroce2023
    @Feroce2023 3 роки тому +80

    Thank you very much, very informative! Now I have to go rewrite all the code I have ever written, wish me luck!

  • @fangjunkuang5061
    @fangjunkuang5061 3 роки тому +65

    C++20 is like a new language

    • @YoloMonstaaa
      @YoloMonstaaa 3 роки тому +9

      no more headers and #include directives 🤯🤯

    • @FPChris
      @FPChris 2 роки тому +2

      I personally never had issues before. int a = 5; has work just fine for DECADES.

  • @dansanger5340
    @dansanger5340 3 роки тому +29

    Excellent talk! It really helps people like me get caught up with the latest developments in C++.

  • @Radioguy00
    @Radioguy00 3 роки тому +7

    Very clear introduction to the new features of C++20. Thanks

  • @vladalu9794
    @vladalu9794 3 роки тому +18

    Marc Gregoire, thank you very much. Your book is one of the best in C++.

    • @marcgregoire
      @marcgregoire 3 роки тому +9

      Thanks, I'm glad you like the book :)

    • @pablom2274
      @pablom2274 11 місяців тому

      @@marcgregoire I took the Cisco entry level c++ course and finished it, do you think I'm a good candidate for the "Professional C++, 5th edition" book? I'm also a fullstack developer with Javascript/Typescript. Thanks!!

  • @haxpor
    @haxpor 2 роки тому +6

    Excellent! Great overview towards c++20 finishing in one go!

  • @mdyousufali5788
    @mdyousufali5788 3 роки тому +3

    Thank you much. Your talk was very comprehensive to follow.

  • @klauselk
    @klauselk 3 роки тому +3

    Very nice walk-through. Thanks a lot.

  • @dariusduesentrieb
    @dariusduesentrieb 3 роки тому +5

    Nice summary, found a few things that will I start to use immediatly.

  • @MohsenKhaki
    @MohsenKhaki 3 роки тому +3

    Thank you for this informative session.

  • @guilherme8829
    @guilherme8829 2 роки тому +4

    Nice presentation. IMHO Modules and concepts are the most helpful features.

    • @CppCon
      @CppCon  2 роки тому

      Glad you think so!

  • @syntaxed2
    @syntaxed2 3 роки тому +2

    This is amazing, so much good stuff!

  • @adrianoraia6153
    @adrianoraia6153 Рік тому +1

    Very useful overview about new features of c++20 with comparison c++17!! Great!!!

  • @MasterOfMisc
    @MasterOfMisc 3 роки тому +13

    This was a fantastic overview of C++ 20. Thank you.

  • @Intoxic_AnimeGuy
    @Intoxic_AnimeGuy Рік тому +1

    Thanks, an excellent overview of C++20!

  • @anoopramakrishna
    @anoopramakrishna 3 роки тому +2

    Quite comprehensive! Thanks!

  • @gerhardwesp3995
    @gerhardwesp3995 3 роки тому +3

    Great overview, thanks!

  • @gg-ij8xb
    @gg-ij8xb 2 роки тому +3

    the speech is very informative. c++20 fabulous. i love it.

  • @Andromeda-Dream
    @Andromeda-Dream 3 роки тому +3

    Great overview!

  • @What-he5pr
    @What-he5pr Рік тому +3

    This is the language version of Christmas morning.

  • @MrGooberman23
    @MrGooberman23 3 роки тому +3

    Thank you for this!

  • @broyojo
    @broyojo 2 роки тому +3

    seems like C++ is getting even more functional

  • @coder2k
    @coder2k 3 роки тому +3

    Great talk, thank you!

  • @axelwimmer4601
    @axelwimmer4601 3 роки тому +1

    Excellent Talk!

  • @aakashs1806
    @aakashs1806 Рік тому +1

    Excellent

  • @jerinmathew995
    @jerinmathew995 3 роки тому +3

    C++ 2O - C++ BORN Again ❤️

  • @konstantinburlachenko2843
    @konstantinburlachenko2843 2 роки тому +2

    Thanks, good talk.

  • @AugustDH
    @AugustDH Рік тому +1

    awesome !

  • @ashishanandnarayanan8996
    @ashishanandnarayanan8996 3 роки тому +5

    Nice to see Rusts Iterators coming to C++.

  • @ayrendraganas8686
    @ayrendraganas8686 3 роки тому +2

    good talk and good audio!!!!

  • @arun_govind
    @arun_govind 3 роки тому +4

    Handful of new features in C++20 and eager to get my hands dirty and see how sweet/painful is it! Overall it was a long journey if we consider the whole transitions from late 90s.

  • @yohanhamilton7149
    @yohanhamilton7149 3 роки тому +1

    This could be one of the most important talks in this year's cppcon

  • @winkeesail2664
    @winkeesail2664 3 роки тому +1

    very comprehensive

  • @zhaoli2984
    @zhaoli2984 3 роки тому +1

    constexprt strings, YES.

  • @gast128
    @gast128 2 роки тому +2

    Good presentation of C++20. It has indeed many attractive new features (e.g. ranges; format; default comparison). Overall the C++ language still suffers from lack of standard libraries compared to e.g. .NET or JAVA; I hope they work on that in the future.

  • @devanshdalal
    @devanshdalal 3 роки тому +5

    How does view::reverse work with infinite sequences like view::ints(10)?

    • @marcgregoire
      @marcgregoire 3 роки тому +4

      first, view::ints(10) was wrong, it has to be "views::iota(10)".
      But, you better limit your sequence when using something like reverse, for example using views::take(...)

  • @arsalananwari4377
    @arsalananwari4377 Рік тому +1

    So essentially C++ as some concepts from functional languages like F# and the pipeline processes of R?
    Nice really handy for Data Science task in larger datasets or streams where python or R are too slow and SQL is too limited 👍🏽

  • @perigord6281
    @perigord6281 2 роки тому +4

    Haven't done much c++20 yet but I do love concepts. Quite similar to typeclasses in haskell

  • @capitalistrealism7680
    @capitalistrealism7680 3 роки тому +3

    Ranges looks somewhat similar to C# linq

  • @leastsquares3412
    @leastsquares3412 Рік тому +2

    It seems like the C++ standardization committee is trying to win over Javascript developers 😂

  • @pablom2274
    @pablom2274 11 місяців тому

    I took the Cisco entry level c++ course and finished it, do you think I'm a good candidate for the "Professional C++, 5th edition" book? I'm also a fullstack developer with Javascript/Typescript. Thanks!!

  • @ramprasadpanigrahy2797
    @ramprasadpanigrahy2797 3 роки тому

    How to install C++ 20 on Red Hat Linux 8 ? I have installed the development tools on RHEL,. GCC and G++ also have been installed. How I can know if the version is C++ 20 ?

  • @abhinavanand3510
    @abhinavanand3510 2 роки тому +1

    One day all code will be constexpr

  • @nabilandadamslaboratory3422
    @nabilandadamslaboratory3422 3 роки тому +6

    Can you please make a cheat sheet with a summary of all the new features? Thanks!

    • @marcgregoire
      @marcgregoire 3 роки тому +3

      I think that would be a rather big sheet, as the C++20 update is quite massive.

  • @JonathanGeisler
    @JonathanGeisler 3 роки тому +1

    Is the coroutine example incorrect because it doesn't use `co_return` after the loop finishes?

    • @marcgregoire
      @marcgregoire 3 роки тому +2

      No, the code is ok. It uses co_yield to return something to the caller. co_return is optional, if you don't need to return something at the end, you can just leave it out. Just like you don't need to write "return;" in normal function.

    • @monsterhunter445
      @monsterhunter445 2 роки тому

      Think of python iterators you just need the yield in the example

  • @Lmao-ke9lq
    @Lmao-ke9lq 3 роки тому +1

    So header Files are no longer needed to use anywhere or anytime?

    • @marcgregoire
      @marcgregoire 3 роки тому +4

      Right, in new code, I would recommend to switch to using modules. It'll benefit your build throughput. But not all compilers are supporting it at the moment ...

  • @allyourcode
    @allyourcode 2 роки тому +1

    re ranges: Finally! We have cast off the shackles of C (or at least one of many), where the "stylish" way to iterate over something was to use a begin and end pointers. Yuck!

  • @idiosinkrazijske.rutine
    @idiosinkrazijske.rutine Місяць тому

    Reminds me of Fortran.

  • @user-rcghjewqw
    @user-rcghjewqw 9 місяців тому

    Who will use all of these???

  • @OneEyedMonkey9000
    @OneEyedMonkey9000 2 роки тому +1

    Does work on compilers happen at the same time as the standard is being decided?

    • @spauldoslady
      @spauldoslady 2 роки тому +2

      Usually. There's generally several draft standards and item-specific documents that get published as part of the standardization process, and compiler vendors are often involved in the process anyway. Sometimes features are just standardizing common extensions the compiler vendors already offer, but I don't know how much of that applies to C++20.

    • @marcgregoire
      @marcgregoire 2 роки тому +1

      Often yes.

  • @konstantinburlachenko2843
    @konstantinburlachenko2843 2 роки тому

    If somebody knows about memory fences guarantees w.r.t. to synchronisation c++ primitives please let me know.

  • @kaleygoode1681
    @kaleygoode1681 3 роки тому

    Did they fix std::set so we can have non const iterators again?!
    It was deliberately broken in the past in case people change the key, preventing changes to any other part of the nodes data!!!🤪

  • @user-rcghjewqw
    @user-rcghjewqw 9 місяців тому

    Not a word about operator | for vector 15:00

  • @alidanish6303
    @alidanish6303 3 роки тому +6

    With every release C++ is Approaching python semantics and syntax

  • @leonid998
    @leonid998 3 роки тому

    54:55, how about a standard way of getting __PRETTY_FUNCTION__-like info ?

    • @marcgregoire
      @marcgregoire 3 роки тому +1

      I'm not sure I understand what you want to do...

  • @vivekmange8745
    @vivekmange8745 Місяць тому

    can I start c++20 without knowing c++???

  • @mapron1
    @mapron1 3 роки тому +2

    49:33 - did you miss constexpr keyword instead of "const" on both slides?

    • @marcgregoire
      @marcgregoire 3 роки тому +1

      No, if you make mm2 constexpr instead of const, then you'll get a compilation error. In my example I wanted to show that even though InchToMm() is marked as constexpr, that you are not guaranteed compile-time execution.

  • @jawadakhtar1
    @jawadakhtar1 3 роки тому

    at 25:00, what is mean by T x { } ?

    • @thorstenschimannek3866
      @thorstenschimannek3866 3 роки тому

      You create an object named x of type T and use "uniform initialization" with the result depending on T. If T is a built in type then it will be uninitialized. If on the other hand it is a class, then the object is created using the default constructor.

    • @marcgregoire
      @marcgregoire 3 роки тому +1

      That just declares a variable x of type T and zero-initializes it.

    • @vladalu9794
      @vladalu9794 3 роки тому

      Default value for T (default ctor or default 0 for int, float, double...)

  • @Abbatyya
    @Abbatyya 3 роки тому +4

    hi, please i start to leaern c++ for the first time, so i start with c++20, i got a book for it, but am having a big problem, i can't have a compiler for it, most of the IDE i use doesn't support the c-++20 features like (import), please i need your help because now i stopped the studying.
    i use these
    VSC extension
    codeblock
    embarcadero
    visual studio 2019
    PLEASE HELP

    • @Abbatyya
      @Abbatyya 3 роки тому

      please i need anyone help

    • @ABaumstumpf
      @ABaumstumpf 3 роки тому +2

      How about not starting with the newest features that are not yet supported universally?
      Just use C++17/14 - they are widely supported.

    • @daniilgavrilikhin34
      @daniilgavrilikhin34 3 роки тому +2

      C++20 is now wastly supported (but not fully) by compilers.

    • @marcgregoire
      @marcgregoire 3 роки тому

      The latest Visual Studio Preview has full support for c++20 modules.

  • @abj136
    @abj136 3 роки тому +14

    Some good and some bad ideas here. My biggest issue is the growing complexity of C++ and having people understand your code when there are so many constructs in the language. Ranges make perfect sense for C++. Views make sense but using | for pipe-filter in addition to OR in other contexts is yet another opportunity for people to see code who hadn't seen that feature just get lost at what they are looking at. It's not necessary to have such features. We can already do filters as a sequence of function calls.

  • @leastsquares3412
    @leastsquares3412 Рік тому +1

    It's really annoying when they use the expression " Now with CXX you don't have to this, you can do this instead... " But why !😢

  • @GameRaccoon
    @GameRaccoon 3 роки тому +2

    Is it only me who thinks that declaring variables like this makes it barely readable?
    auto var { int { 10 } };

  • @hanyanglee9018
    @hanyanglee9018 2 роки тому

    Thank Typescript for giving me better TypeC++20.

  • @Schcarraffone
    @Schcarraffone 2 роки тому +1

    many of these ... topics.. ...ideas... ...concepts... so to say were already discussed in the circles of programming languages creators and of programmers in the last years...
    in fact I find the D programming language has already all the benefits of those and has ALREADY today for example a better implementation of the module mechanisms...
    only sad that it is not as visible as C++ ....

  • @sevenbit
    @sevenbit 3 роки тому +1

    ​the problem with source_location is that in a real logger you would expect to forward arguments to std::format.. but having arbitrary argument count is not possible with the last source_location param.
    nice summary tho, i enjoyed. Thanks!

    • @daniilgavrilikhin34
      @daniilgavrilikhin34 3 роки тому

      You still can forward it to std::format as it ignores unused args. Or you can provide a specialization (I think) that will do nothing.

  • @stevenzhang6150
    @stevenzhang6150 3 роки тому +4

    It's a great lecture.
    Tho I don't really like computer science. It's all about keeping making new concepts and names for people to learn and make simple stuff more and more confusing to keep their job secured.

    • @Maciej-Komosinski
      @Maciej-Komosinski 3 роки тому +3

      So you would like to keep developing computer science without making new concepts, or you accept making new concepts but you would like them to be left unnamed? I guess you have similar criticism for, say, medicine, chemistry, physics, etc.?

  • @leastsquares3412
    @leastsquares3412 Рік тому +1

    C++ 20 just clusters the c++ landscape. I just don't get it why the committee is constantly adding language features that have no impact on performance. I mean, no one comes to C++ for its "cool" language features.

  • @shuvagatasarkershuvo6670
    @shuvagatasarkershuvo6670 3 роки тому +3

    C++ 23: pointers are removed, no data types- it's basically Python! That's my guess.🙄

    • @TheMR-777
      @TheMR-777 2 роки тому +1

      Well, that's not gonna happen for sure.
      C++ borrows the idea based features from Higher Level Languages, but using Dynamic Type System like Python, will make it slow like Python :)

    • @gast128
      @gast128 17 днів тому

      Is it going the other direction; i.e Python and JavaScript getting type annotations?.