samedi 26 septembre 2015

How to use enum class without a scope

I need to use the enumerator of the enum class multiple times in one block of code and I would like to avoid the classical enum from C++03.

enum class Color {RED, GREEN};
{
    Color::RED //this works
    RED;       //how do I make this work (only for this block)?
}

I tried using

using namespace Color;

but it obviously did not work since Color is not a namespace.

Aucun commentaire:

Enregistrer un commentaire