Xirdus
Xirdus

Reputation: 3087

enum flags with name

I'm going to use enum flags for options to initialize my class. The enum is:

namespace MCXJS
{
    enum VARPARAM
    {
        STATIC = 1,
        CONST = 2
    }

    //other things
}

If I'm right, in this case, to check for STATIC I need to do this:

if (param & MCXJS::VARPARAM::STATIC) //...

I know to do it this way:

if (param & MCXJS::STATIC) //...

i need to delete enum name. But it that really necessary? Cannot I use enum values of named enum without typing its name everywhere?

Upvotes: 0

Views: 387

Answers (1)

Johannes Schaub - litb
Johannes Schaub - litb

Reputation: 507353

Huh? You don't need to prefix it with the enumeration name. That's only needed for C++0x enum class scoped enumerations.

Upvotes: 2

Related Questions