C++ Insights - Episode 19: How variadic templates work

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

КОМЕНТАРІ • 7

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

    I finally understand variadic templates. Thank you!

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

    That was very helpful, thanks!

  • @davithov
    @davithov 7 місяців тому +1

    So, in line 13 it is written min(m, ts....); Does that mean that at each step we reduce number of params in ts by 1 and pass it to 'b' ?
    it is also a bit confusing for me where exactly to put '...' . For example, why it is wrong to write like this: template

    • @andreas_fertig
      @andreas_fertig  7 місяців тому +1

      Yes, we reduce the number of parameters by merging the minimum of a and b into a. Then, we grab the first parameter of the pack and pass it to b, reducing the number of parameters in the pack by one in each iteration.
      To your second part, it is convention. The ellipsis goes right to the entity it belongs to. In your example, the typename.

    • @davithov
      @davithov 7 місяців тому

      @@andreas_fertig Thank you very much for personally answering to my question! It is an honour for me.

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

    why C++ is so fucking cmplex XDD?