Consider the following class:
template <class T>
class bitcode<T Endianness>
{};
With Endianness that could be: default_endianness, little_endian or big_endian.
The question is the following: according to C++14 and the following C++17, what is/will the best and common practices? (by common I mean those used (or which will be used) by the stl or boost. (+ and why?)
// The enum option
enum endianness {default_endianness, little_endian, big_endian};
// The enum class option
enum class endianness {default_endianness, little_endian, big_endian};
// The class option
class default_endianness{};
class little_endian{};
class big_endian{};
(Note: of course the declaration of bitcode will depend on the prefered option.)
Aucun commentaire:
Enregistrer un commentaire