Lightning Talk: A Templated Grandfather Paradox in C++ - Jonathan Storey - C++ on Sea 2023

Поділитися
Вставка
  • Опубліковано 12 вер 2024

КОМЕНТАРІ • 10

  • @davidsicilia5316
    @davidsicilia5316 10 місяців тому +4

    The C++ language, when wielded properly, can really hit the sweet spot between engineering and creative art.

  • @ddimin
    @ddimin 10 місяців тому +4

    A quick note: inheriting from an empty struct doesn't increase `sizeof` (because of "empty base optimization"). However, adding a member always increases `sizeof`.

    • @VincentZalzal
      @VincentZalzal 10 місяців тому

      I haven't used it myself, but as of C++20, there is now the no_unique_address attribute to specify no storage for empty members (msvc::no_unique_address in msvc, unfortunately).

    • @ddimin
      @ddimin 10 місяців тому

      @@VincentZalzal Wow, thanks, I didn't actually know about that. It seems that with C++ no matter how many years or decades of experience you've got, you still learn about new features... I actually have a place in mind, where I could use that...

  • @Solarbonite
    @Solarbonite 10 місяців тому +1

    Loved the switcheroo at the end.

  • @awawus
    @awawus 10 місяців тому

    The attempt to add a member dynamically (at compile time) reminded me of the mix-in pattern

  • @thelatestartosrs
    @thelatestartosrs 10 місяців тому +1

    see std::tuple

  • @anon_y_mousse
    @anon_y_mousse 10 місяців тому

    I don't know if anyone else will agree, but I dislike redundant syntax. For my own language, which no one will use, specializing on no arguments would just be the class name without an empty template specifier list.

  • @bigzigtv706
    @bigzigtv706 10 місяців тому

    Hope i never have to work with templates

    • @graphicsRat
      @graphicsRat 10 місяців тому

      You already work with templates if you use STL.
      If you go out of your way to avoid templates you will write A LOT of repetitive code.
      Templates require a mindshift but they are immensely powerful.