Templates Made Easy With C++20 - Roth Michaels - C++ on Sea 2023

Sdílet
Vložit
  • čas přidán 12. 09. 2023
  • cpponsea.uk/
    ---
    Templates Made Easy With C++20 - Roth Michaels - C++ on Sea 2023
    C++ templates are a powerful tool for compile-time programming, generic programming, and metaprogramming. Historically many of these techniques have been considered advanced techniques or even arcane-magic by many C++ developers. Complex error messages and concepts like SFINAE being hard to teach can leave use of C++ templates out of reach-if you don’t know what SFINAE, come to this talk and find out what it is and why you might not need to use it anymore.
    With C++17/20, constexpr, consteval, concepts, and fold expressions can change the way we teach a write C++ for compile-time programming, generic programming, and metaprogramming. This talk will cover these new C++ features and show how they change the templated C++ one would have written in the past.
    After demonstrating how to use and write concepts, we will look at some examples of production UI library code that can be simplified to be easier to write and understand by adopting C++20 concepts combined with constexpr/consteval and fold expressions.
    See lessons learned by teams that have moved to C++20 and started using concepts, and how your teams could benefit from these features in the latest C++ standards.
    ---
    Slides: github.com/philsquared/cppons...
    Sponsored By think-cell: www.think-cell.com/en/
    ---
    Roth Michaels
    Roth Michaels is a Principal Software Engineer at iZotope/Soundwide, an industry leader in real-time audio software for music production and broadcast/film post-production. In his current role on the Audio Research Team at iZotope's parent company, Soundwide, he is focused on developing new fast prototyping frameworks. When he joined iZotope, Roth was the lead library designer of a new internal cross-platform "Glass", part of which is now available as open-source. More recently in his former role as Mix/Master Software Architect, Roth helped develop the reference implementation to move iZotope's products to subscription and led the team that launched the company’s first SaaS offering for music producers. Roth studied music composition at Brandeis University and continued his studies in the Dartmouth Digital Musics program. Roth began his career in software development writing software for his own compositions, and the works of other composers and artists, and teaching MaxMSP to composers and musicians; both private instruction and designing university courses. Before joining iZotope, he was working as a consultant for small startups working on mobile applications specializing in location services and Bluetooth.
    ---
    C++ on Sea is an annual C++ and coding conference, in Folkestone, in the UK.
    - Annual C++ on Sea, C++ conference: cpponsea.uk/
    - 2023 Program: cpponsea.uk/2023/schedule/
    - Twitter: / cpponsea
    ---
    CZcams Videos Filmed, Edited & Optimised by Digital Medium: events.digital-medium.co.uk
    #cpp​ #cpponsea​ #cppprogramming
  • Věda a technologie

Komentáře • 7

  • @Roibarkan
    @Roibarkan Před 8 měsíci +2

    15:58 note that it might be better to move such “inner requires” outside, because concepts that are boolean expressions have ‘subsumption rules’ which are meant to help the compiler with potential conflicts. This example will look something like “… concept ConcatPlus = requires(T a, U b) {a+b;} && same_as && …”.

  • @ABaumstumpf
    @ABaumstumpf Před 8 měsíci +6

    No i would really say just the error-messages are a wwwaaaaayyyy bigger and more helpful feature of concepts. Most code i see does not write templates but is trying to use them. And most of the time when somebody has a problem the compiler "clearly tells them what is wrong" - in line 56 of 491 lines of error-messages in a giant wall of text.
    Once you have containers-of-containers and just the type alone is 5 lines of code you really do not want to use them anymore cause if you then have something simple like trying to emplace-back a templated class that 3 layers down contains a unique_ptr ... you will curse and the crap that are C++ template compiler warnings.

  • @ollegio
    @ollegio Před 7 měsíci +1

    Could someone explain why you would need a concept for something that has a Process function instead of an interface

    • @iy908
      @iy908 Před 7 měsíci +2

      Near realtime software like audio processing tries to eliminate any source of delays during the execution of the critical path. Resolving vtable when you use interfaces could be a source of such delays

    • @ZeroPlayerGame
      @ZeroPlayerGame Před 6 měsíci

      Concepts are kind of (a lax version of) compile-time interfaces. Rust & Swift use the same language feature for both static and dynamic interfaces, but I imagine "strict" templates like this would be hard to add to C++ without breaking someone's code.

  • @pawello87
    @pawello87 Před 6 měsíci +1

    Concepts are great.
    TDD is overrated.

  • @WalderFrey
    @WalderFrey Před 8 měsíci +3

    More "explained hurredly" than "made easy" I'm afraid. Developers don't always make good educators.