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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:22:31+00:00 2026-06-11T19:22:31+00:00

Why does the C++ standard define two phase lookup for templates? Couldn’t non dependent

  • 0

Why does the C++ standard define two phase lookup for templates? Couldn’t non dependent declarations and definitions’ lookups be deferred to the instantiation stage as well?

  • 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-06-11T19:22:32+00:00Added an answer on June 11, 2026 at 7:22 pm

    They could. This is the way most early implementations of templates
    worked, and is still the way the Microsoft compiler worked. It was felt
    (in the committee) that this was too error prone; it made it too easy to
    accidentally hijack a name, with the instantiation in one translation
    unit picking up a local name, rather than the desired global symbol. (A
    typical translation unit will consist of a sequence of #includes,
    declaring the names that everyone should see, followed by implementation
    code. At the point of instantiation, everything preceding the point of
    instantation is visible, including implementation code.)

    The final decision was to classify the symbols in a template into two
    categories: dependent and non-dependent, and to insist that the
    non-dependent symbols be resolved at the point of definition of the
    template, to reduce the risk of them accidentally being bound to some
    local implementation symbols. Coupled with the requirement to specify
    typename and template when appropriate for dependent symbols, this
    also allows parsing and some error checking at the point of definition
    of the template, rather than only when the template is instantiated.

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

Sidebar

Related Questions

Why does the Standard define end() as one past the end, instead of at
Does the HTTP standard or something define which encoding should be used on special
Does the standard define precisely what I can do with an object once it
What does standard specify about indexing sequence with Attr objects inside NamedNodeMap object? I
Does the standard guarantee that order of equal elements will not change (eh, forgot
Does exist a standard protocol for network printers? Some network printers require the installation
Does the C standard support something similar to __func__ for the function arguments' names?
Standard Java does not offer an object implementing the Queue interface on top of
Question What does the C++ standard guarantee about the state of an object in
Does anyone know a standard way to keep alive the http session as long

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.