Back to Basics: Templates in C++ - Nicolai Josuttis - CppCon 2022

Sdílet
Vložit
  • čas přidán 25. 10. 2022
  • cppcon.org/
    ---
    Back to Basics: Templates in C++ - Nicolai Josuttis - CppCon 2022
    github.com/CppCon/CppCon2022
    Templates are among the most powerful features of C++, but they remain misunderstood and underutilized, even as the C++ language and development community have advanced. This talk shows when and how to use modern templates to build software that's cleaner, faster, more efficient, and easier to maintain. We will cover all basic aspects of templates you have to know when programming generic code in Modern C++
    ---
    Nicolai Josuttis
    Nicolai Josuttis is well-known in the community for his authoritative books and talks. For more than 20 years he has been a member of the C++ Standard Committee. He is the author of several worldwide best-sellers, including:
    - C++20: The Complete Guide
    - C++17: The Complete Guide
    - C++ Move Semantics: The Complete Guide
    - The C++ Standard Library: A tutorial and Reference
    - C++ Templates: The Complete Guide (w/ David Vandevoorde & Doug Gregor)
    __
    Videos Filmed & Edited by Bash Films: www.BashFilms.com
    CZcams Channel Managed by Digital Medium Ltd events.digital-medium.co.uk
    #cppcon #programming #template
  • Věda a technologie

Komentáře • 40

  • @moderncpp
    @moderncpp Před rokem +13

    Great talk. I believe that understanding templates reveals most of the C++ programming language.

  • @superscatboy
    @superscatboy Před rokem +15

    Nico is a great speaker, I've been looking forward to this one!

  • @deadbird99
    @deadbird99 Před rokem +4

    Hands down the best templates course I've ever had. Thanks!!

  • @MyLucjusz
    @MyLucjusz Před 10 měsíci

    That's a pure pleasure to listen to the prelection like this. Thank you!

  • @Tony-tu8uz
    @Tony-tu8uz Před rokem +1

    Very good! Thank you for the talk!

  • @prafulsrivastava7684
    @prafulsrivastava7684 Před rokem +4

    This is exactly what I was looking for! Great talk!

  • @wigglyk2796
    @wigglyk2796 Před rokem +6

    Wow the master himself. His book on templates is excellent. Thanks for this video.

    • @CppCon
      @CppCon  Před rokem +1

      Glad to hear that you enjoyed this presentation!

  • @brandonz6121
    @brandonz6121 Před rokem +2

    A truly insightful talk!

  • @parthapratimmukherjee
    @parthapratimmukherjee Před měsícem

    Its amazing how Nico can make extremely complex topics approachable. I bought all his books!

  • @richardvonlehe4581
    @richardvonlehe4581 Před rokem +3

    Well done! Engaging throughout.

  • @NickEnchev
    @NickEnchev Před rokem

    Excellent talk, thank you.

  • @FloBee10
    @FloBee10 Před 5 měsíci

    thank you. even better the second time around! : )

  • @OptimusVlad
    @OptimusVlad Před rokem +3

    Wow, this is trippy. Didn't know this was a thing:
    if constexpr (requires {coll.push_back(val);})

  • @yowadup1000
    @yowadup1000 Před rokem

    Looks pretty exciting!

  • @the_real_foamidable
    @the_real_foamidable Před rokem +20

    Very cool talk. Always good to recapitulate the basics - there are to many things we use without understanding the underlying tech and history.
    BTW: Where can I get this awesome T-Shirt?

  • @viacheslav1392
    @viacheslav1392 Před rokem

    Great talk man!

  • @xFabi99
    @xFabi99 Před rokem

    Templates are pretty awesome now, as is this talk ;)

  • @mahdies56
    @mahdies56 Před 7 měsíci

    Great talk

  • @dark808bb8
    @dark808bb8 Před rokem +5

    We need an "if compiles{" expression that takes the first branch if the code in that branch compiles 😅

    • @chudchadanstud
      @chudchadanstud Před 4 měsíci

      The much needed. We need better metaprogramming.

  • @ssmondal007
    @ssmondal007 Před 5 měsíci

    Super Sir, impressed :)

  • @nithu9227
    @nithu9227 Před rokem

    Very useful

  • @paulselormey7862
    @paulselormey7862 Před rokem

    Josuttis, thank you.

  • @ZackDia-Ptr
    @ZackDia-Ptr Před rokem

    Good stuff...

  • @xudongsun
    @xudongsun Před rokem +2

    love his tshirt. where can I get one?

  • @MalcolmParsons
    @MalcolmParsons Před rokem

    35:46 std::complex is only specified for float, double and long double, not for int.

  • @sanjaygatne1424
    @sanjaygatne1424 Před rokem

    nice talk.
    i had one query on slide no.31, why recursive call to "if" statement when you know number of var args. why not "range for".

    • @thepiratepeter4630
      @thepiratepeter4630 Před rokem

      You can't iterate on an argument pack like you would do with a container, because the types of the various elements could be different.

    • @thepiratepeter4630
      @thepiratepeter4630 Před rokem

      In his specific example you could avoid recursion using a fold expression.

    • @atib1980
      @atib1980 Před rokem

      There isn't a foreach construct in C++ that would allow you to loop through a range of data of different data types at runtime. C++ foreach works on only those data types that have implemented the basic input iterator related operators defined by the requirements of input iterators (begin(), end() operator++() and operator*). In the example on slide 31 you just want to print every fn argument on a separate line (where fn argument is of a certain type for which ostream& operator

  • @djupstaten2328
    @djupstaten2328 Před rokem +1

    This is why a TypeEval function is screaming to be created. I am 100% certain the std::people can create a better one than I can. Typeid() doesn't actually consider a tuple of string/int/string the same type as a tuple of variant/variant/map as the same types so there is no secure way to funnel them into whatever place or process they need to be. A bool function is totally fine as long as it is general (i.e. one container type instance should match with another, and with its type-name, regardless of their particular flavor of chaos inside). Knowing everything at compile time is neither realistic nor creatively workable. "Strongly typed" needs to not just be a begrudging neurosis or a religious mantra but also lead to supplying the proper tools for the coder to secure this strength on his or her end.

  • @BiddutMitra
    @BiddutMitra Před rokem

    C with better structure, which is c++.

  • @ifeanyioraelosi7305
    @ifeanyioraelosi7305 Před rokem

    Interesting talk, though not as 'basic' as I assumed.
    It would have been helpful if the speech bubbles were removed; the code in the speech bubbles could have been placed side-by-side with the code on the left. For example, at 4:18, the text in the speech bubble could have been replaced with the code on the left but with "T" and "typename" swapped out for "CustomType" and "class". The explanation need not change.
    4:16 "...use a better name, like CustomType as shown in the example on the right".
    3:37 "...can be replaced by class, as you can see in the example on the right..."
    Edit: I just noticed the speech bubbles do help as annotations in other slides.

  • @alib5503
    @alib5503 Před 4 měsíci +1

    It feels, to me, i have to know all of c++. Idk why. Whenever he waives his hands on some somewhat deprecated or irrelavant topics or on some dark corners, i t feels unsatisfactory...

  • @vasylvoina6663
    @vasylvoina6663 Před rokem

    I call function templates for 145 000 different types, so I end up with 145 000 functions generated. Wow, really nice feature.

  • @__hannibaalbarca__
    @__hannibaalbarca__ Před rokem +4

    _CppCon_ please keep politic out.

  • @yseeme
    @yseeme Před 10 měsíci +5

    Keep C++ away from stupid politics

  • @user-0xDEEDBEEF
    @user-0xDEEDBEEF Před rokem +8

    Do you job. Do not go politic.