Lightning Talk: Help! My Expression Template Type Names Are Too Long! - Braden Ganetsky CppCon 2023

Поділитися
Вставка
  • Опубліковано 14 кві 2024
  • cppcon.org/
    ---
    Lightning Talk: Help! My Expression Template Type Names Are Too Long! - Braden Ganetsky - CppCon 2023
    github.com/CppCon/CppCon2023
    Even the name of this talk is too long! If we're ever working with expression templates, we can easily make type names long enough to slow down compilation time. Suddenly our "zero-overhead" expression templates start giving a large compile time overhead. I'll show off a C++20 trick to fix this problem.
    ---
    Braden Ganetsky
    Braden Ganetsky graduated from the University of Manitoba with a degree in mechanical engineering, but soon pivoted to C++. Now he spends his days working on supply chain simulation software, and spends his nights working on parser combinators and getting involved in the C++ community.
    ---
    Videos Filmed & Edited by Bash Films: www.BashFilms.com
    UA-cam Channel Managed by Digital Medium Ltd: events.digital-medium.co.uk
    ---
    Registration for CppCon: cppcon.org/registration/
    #cppcon #cppprogramming #cpp
  • Наука та технологія

КОМЕНТАРІ • 19

  • @314Labs
    @314Labs Місяць тому +15

    That parsing library is incredible I wanna use it rn

  • @AnthonyDentinger
    @AnthonyDentinger Місяць тому +13

    This is so stupid. And I love it!

  • @danielmilyutin9914
    @danielmilyutin9914 Місяць тому +2

    I'd love to know all the tricks about this, too.
    Crossplatform prefferered.

  • @guiorgy
    @guiorgy Місяць тому +2

    Interesting find

  • @sonulohani
    @sonulohani Місяць тому +1

    Nice video

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

    Template type names are actually weird in C++. I just used std::map but when it hit an error, the compiler also showed me the default typename of that std::map and that took me a couple minutes to figure out what happended 😂

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

    Doesn't mputz/mp-units use a trick with the same objective to keep the names of the type quantities short?

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

    Isn't metaprogramming with concepts and variadic templates instead of SFINAE and traditional templating supposed to fix that issue or at least contribute to doing so?

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

    Why not make a template Add{} and implement operator+ such that the whole sum will result in one Add instantiation? Do I miss a point here?

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

      operator+ is a binary operation.

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

    why only msvc tho ?🙄

  • @ABaumstumpf
    @ABaumstumpf Місяць тому +3

    But now the question: why make all that a giant pile of templates?

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

      I'm not an expert but maybe the Wikipedia article for expression templates can explain that

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

      Because we can 😅

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

      Why make expression templates a bunch of templates? Good question.

    • @ruadeil_zabelin
      @ruadeil_zabelin Місяць тому +2

      The parsing lib he showed in the beginning was a very good example of why this would happen. I have a similar case for a stream/pipeline library. I can also see this happen with composable allocators as described in andrej alexandrescu's talk about allocators from a couple of years ago.

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

      Bacause C++ is a steaming pile of hot garbage

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

    Thumbs up for joy!