vendredi 29 juillet 2016

advantages of template < auto > in C++17

What are the advantages of template < auto > that will (possibly) be introduced with C++17?

Is it just a natural extension of auto when I want to instantiate template code?

auto v1 = constant<5>;      // v1 == 5, decltype(v1) is int
auto v2 = constant<true>;   // v2 == true, decltype(v2) is bool
auto v3 = constant<'a'>;    // v3 == 'a', decltype(v3) is char

What else do I gain from this language feature?

Aucun commentaire:

Enregistrer un commentaire