[Core] scoped_enum and template arguments

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[Core] scoped_enum and template arguments

Boost - Users mailing list

I'm a little confused about the following statement in the docs for
scoped enum:

 > The emulated scoped enum can not be used in switch nor in
 > template arguments.


I understand the rationale for the switch statement part (and indeed it
won't compile in C++03).

However, I'm struggling to grasp the template argument part (and I'll be
the first to admit I'm not particularly strong with templates).
Unlike the switch case, any basic scenario I've thrown at it compiles.
So I'm not sure if this is a case of "should not" vs "can not".

When would using a "scoped_enum_type" in a template argument as opposed
to "BOOST_SCOPED_ENUM_NATIVE(scoped_enum_type)" become a problem?

Or, why should I use

I've got a compiler explorer link with some test code here if it helps:


Boost-users mailing list
[hidden email]