lundi 5 août 2019

Any reason to use enum within this Int2Type

Going through "Modern C++ Design by Alexei", I am unable to understand the reason for using unnamed, unscoped enum in this template definition, instead of using a variable directly.

Does it have any advantages?

template <int v>
struct Int2Type
{
   enum { value = v }; //why not use int value = v;
};

Aucun commentaire:

Enregistrer un commentaire