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 6330741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:55:38+00:00 2026-05-24T17:55:38+00:00

A point from the ISO C++ draft (n3290): 3.4.3.2/1 Namespace members If the nested-name-specifier

  • 0

A point from the ISO C++ draft (n3290): 3.4.3.2/1 Namespace members

If the nested-name-specifier of a qualified-id nominates a namespace,
the name specified after the nested-name-specifier is looked up in
the scope of the namespace. If a qualified-id starts with ::, the
name after the :: is looked up in the global namespace. In either
case, the names in a template-argument of a template-id are looked up
in the context in which the entire postfix-expression occurs.

Here can any one explain about the BOLD part …. and from earlier c++03 draft to c++0x draft he added

If a qualified-id starts with ::, the name after the :: is looked up
in the global namespace.

can any one explain with an example program please

  • 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-24T17:55:38+00:00Added an answer on May 24, 2026 at 5:55 pm

    ::S is a qualified-id.

    In the qualified-id ::S::f, S:: is a nested-name-specifier.

    In informal terms, a nested-name-specifier is the part of the id that

    • begins either at the very beginning of a qualified-id or after the initial scope resolution operator (::) if one appears at the very beginning of the id and
    • ends with the last scope resolution operator in the qualified-id.

    Very informally, an id is either a qualified-id or an unqualified-id. If the id is a qualified-id, it is actually composed of two parts: a nested-name specifier followed by an unqualified-id.

    Given:

    struct  A {
        struct B {
            void F();
        };
    };
    
    • A is an unqualified-id.
    • ::A is a qualified-id but has no nested-name-specifier.
    • A::B is a qualified-id and A:: is a nested-name-specifier.
    • ::A::B is a qualified-id and A:: is a nested-name-specifier.
    • A::B::F is a qualified-id and both B:: and A::B:: are nested-name-specifiers.
    • ::A::B::F is a qualified-id and both B:: and A::B:: are nested-name-specifiers.

    Another example:

    #include <iostream>
    using namespace std;
    
    int count(0);                   // Used for iteration
    
    class outer {
    public:
        static int count;           // counts the number of outer classes
        class inner {
        public:
            static int count;       // counts the number of inner classes
        };
    };
    
    int outer::count(42);            // assume there are 42 outer classes
    int outer::inner::count(32768);  // assume there are 2^15 inner classes
                                     // getting the hang of it?
    
    int main() {
        // how do we access these numbers?
        //
        // using "count = ?" is quite ambiguous since we don't explicitly know which
        // count we are referring to.
        //
        // Nested name specifiers help us out here
    
        cout << ::count << endl;        // The iterator value
        cout << outer::count << endl;           // the number of outer classes instantiated
        cout << outer::inner::count << endl;    // the number of inner classes instantiated
        return 0;
    }
    

    EDIT:

    In response to your comment, I believe that statement simply means that the arguments of a template are handled w.r.t the context and line by which they are declared. For example,

    in f.~foo();, foo is looked up within f., and within the scope of foo<int>, it is valid to refer to it just with with foo.

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

Sidebar

Related Questions

A point from the ISO C++ draft (n3290): 3.4.3.2/1 Namespace members For a namespace
A point from the ISO C++ Draft n3290 : 3.4.0 2nd point A name
A point from N3290 draft ISO Standard, §3.4.1/12: During the lookup of a name
A point from ISO C++ DRAFT n3290 :Argument dependant Name Lookup : section 3.4.2,
A point from ISO draft N3290 : Unqualified Name Lookup :section 3.4.1, para 14:
A point from the ISO C++ draft (n3290): 3.4.2/3 Argument Dependant Name Lookup: Let
A point from n3290 ISO draft: Lambda expressions : section 5.1.2, para 6: The
A point from ISO draft n3290 section 3.4.2 paragraph 1: When the postfix-expression in
A point from ISO draft n3290 section 3.3.9 paragraph 4: The declarative region of
A point from iso C++ n3290 :Argument dependant Name Lookup: section 3.4.2, para 4

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.