Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6585785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:42:28+00:00 2026-05-25T16:42:28+00:00

The new C++ (C++0x or C++11) has an new kind of enum, an enum

  • 0

The new C++ (C++0x or C++11) has an new kind of enum, an “enum class” where the names are scoped to the enum (among other things).

enum class E {
    VAL1, VAL2
};

void fun() {
    E e = E::VAL1;  // Qualified name
}

I’m wondering, however, if I can selectively use the unqualified name in a certain scope. Something like:

void fun() {
    using E::*;
    E e = VAL1;
    switch (e) {
        case VAL2: ...

I see I can write using E::VAL1 and get one value. But I don’t want to do that for every value of a larger enum.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T16:42:28+00:00Added an answer on May 25, 2026 at 4:42 pm

    There is no way to do this in C++11. Just in case you are not aware of it – you get the E::Val1 notation even for an unscoped enumeration. For such an enumeration, you have Val1 accessible with and without the use of E::.

    But you cannot take a scoped enumeration and selectively make all its enumerators visible in a given scope. It should also be noted that you can not write using E::Val1. The spec explicitly forbids this, your compiler just doesn’t reject it yet.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The new Android 2.1 SDK (version 7) has a new class called SignalStrength: http://developer.android.com/reference/android/telephony/SignalStrength.html
The new table has an auto-increment that I want to use for the data
A new colleague has just suggested using named HQL queries in Hibernate with annotations
I need add a new user group for mediawiki. The new group has more
The new iPhone 3GS has support for voice commands, stuff like call Bill or
UNIQLO's new alarm app has a custom UIDatePicker : And I want to create
I've read that Firefox 3.5 has a new feature in its parser ? Improvements
In my example, I'm trying to create a new object which has references to
C# has a cool new feature public Task<string> async f() { string r =
The new version of SQLite has the ability to enforce Foreign Key constraints, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.