mz71
mz71

Reputation: 224

Define static anonymous enum outside the class

So I have class like this:

class Foo
{
static enum {a,b,c} member;
}

A fine one member class. But, there is a need for defining static members outside classes. Using my VS 2013 I tried:

enum {a,b,c} Foo::member;

But it failed. Is there any way of defining it?

Upvotes: 2

Views: 87

Answers (1)

Luchian Grigore
Luchian Grigore

Reputation: 258568

You can use decltype:

class Foo
{
    static enum {a,b,c} member;
};  // <--- also note semicolon

decltype(Foo::member) Foo::member;

Upvotes: 1

Related Questions