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

  • Home
  • SEARCH
  • 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 1070607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:35:23+00:00 2026-05-16T20:35:23+00:00

This is the statement from ISO C++ Standard 14.6/8: When looking for the declaration

  • 0

This is the statement from ISO C++ Standard 14.6/8:

When looking for the declaration of a name used in a template definition, the usual lookup rules are used for nondependent names. The lookup of names dependent on the template parameters is postponed until the actual template argument is known (14.6.2).

Example:

  #include <iostream>
  using namespace std;
  template<class T> class Set {
            T* p;
            int cnt;
  public:
            Set();
            Set<T>(const Set<T>&);
            void printall()
            {
                        for (int i = 0; i<cnt; i++)
                                   cout << p[i] << ’\n’;
            }
            // ...
  };

in the example, i is the local variable i declared in printall, cnt is the member cnt declared in Set,and cout is the standard output stream declared in iostream. However, not every declaration can be found this way; the resolution of some names must be postponed until the actual template-arguments are known. For example, even though the name operator<< is known within the definition of printall() and a declaration of it can be found in , the actual declaration of operator<< needed to print p[i] cannot be known until it is known what type T is (14.6.2).

Iam unable to understand this point…and the example too?

can any one tell an other example for this statement…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-16T20:35:24+00:00Added an answer on May 16, 2026 at 8:35 pm

    Looking only at the template, can you tell me what the type of p[i] is? No. The type of p[i] in Set<int> will be int ; the type of p[i] in Set<std::string> will be std::string. Hence, the lookup of operator<< has to be delayed until the template is instantiated and the type of p[i] is known.

    You’d have a similar issue in (assume this is another member of Set<T>)

    // In Set<T>
    void reverse()
    {
      for (int i = 0; i <= cnt-i; ++i)
      {
        using std::swap;
        swap(p[i], p[cnt-i]);
      }
    }
    

    The lookup of swap will also need the type of p[i], even though there’s a using declaration directly in front.

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

Sidebar

Related Questions

This is the statement from ISO C++ Standard 14.6/6: Within the definition of a
This is the statement from ISO C++ Standard 14.6.2.4: Dependent template arguments : A
This is the statement from ISO C++ Standard 14.6.4.1 Point of instantiation 4.If a
This is the statement from ISO C++ Standard 14.6.4.1 Point of instantiation For a
This is the statement from ISO C++ Standard 14.6.2.1: Dependent types : A type
We have this statement: (SELECT res_bev.bev_id, property_value.name AS priority FROM res_bev, bev_property, property_value WHERE
I need to change table name from lowercase to uppercase but using this statement
Using this statement: select * from qvalues where rowid ,name,compound in ( select rowid,name,compound
Can anyone explain this statement from ISO N3242 §3.2, 2nd point An expression is
Can anyone explain this statement from ISO N3242 §3.2, 2nd point A member of

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.