mardi 25 décembre 2018

C++11 enum class namespace block

I have an enum class in C++11:

enum class eDays{ Sunday, Monday, .. , COUNT };

The enum class sets the namespace for the values so it has to be used like:

eDays::Sunday

I want to set an namespace block so I won't need to specify the namespace each time something like:

namespace eDays {
    vector<eDays> vec = { MONDAY, SUNDAY, ..  };
}

Instead of:

vector<eDays> vec = { eDays::MONDAY, eDays::SUNDAY, ..  };

What am I missing?

Aucun commentaire:

Enregistrer un commentaire