samedi 3 août 2019

Template parameter list with default class

Does anyone have an example for 2 and 3? I try to understand the writing style of the standard, and other documentations about C++. In specific here the template documentation.

Both is probably wrong, but I try to understand their differences. Source: https://en.cppreference.com/w/cpp/language/template_parameters

template < parameter-list > typename(C++17) | class name(optional) (1)

template < parameter-list > typename(C++17) | class name(optional) = default (2)

template < parameter-list > typename(C++17) | class ... name(optional) (3) (since C++11)

1) A template template parameter with an optional name.

2) A template template parameter with an optional name and a default.

3) A template template parameter pack with an optional name.

I am not sure if I interpret this correctly. As far as I understand...

// 2
template <typename T, typename Y> class Foo = default; // this can't be right, can it?

// 3
template <typename T, typename Y> class ... Foo;

Aucun commentaire:

Enregistrer un commentaire