CPP templates name classification and name search

Source: Internet
Author: User
Name category:

Identifier: an uninterrupted Character Sequence consisting of characters, numbers, and underscores
Operation ID operator-function ID: operator, such as *, %, + \-,
Forced conversion ID conversation-function ID: static_cast, dynamic_cast, and so on
Template ID template ID: Template Name
Unrestricted ID unqualified-ID: generalized identifier,
Restricted ID qualified-ID: Use a class name or namespace name to limit an unqualified-ID
Restricted name qualified name:
Unqualified Name:
Dependent name: dependent on template parameters
Non-dependent name undependent name: does not depend on template parameters

Name Search:

Restricted name: search within restricted scope
Unrestricted name: visible at the call point and ADL argument-dependent Lookup

ADL:
In the process of calling a function, if the name of the function can be found by common search, then the ADL will not be applied. If you call a letter

The number name is enclosed in parentheses (), such as (max), and ADL is not called. Otherwise, if there is

Or multiple real parameter expressions, then the associated class and associated namespace of these real parameters.
For the exact definition of the set composed of associated class and associated namespace for a given type, we

The following rules can be used to determine whether:
1. This set is null for the basic type.
2. for pointers and reference types, This set is the class pointed to by the pointer and the associated class and associated namespace of the type referenced by the reference lock.
3. For the enumeration type, associated namespace is the namespace in which it is located; for class members, associtated

Class refers to its class.
4. For the class type (including the Union type), the associated class set includes: the class itself, its peripheral type,

Its direct and indirect base classes. The associated namespace set is the namespace of each associated class. For example

If this class is generated by class template instantiation, it also includes the type of the template type real parameters and the template real parameters of the declared template.

In the class and namespace
5. For function types, this set includes all parameter types and returned types of associated class and associated

Namespace
6. For the member pointer type of Class X, except for the member-related associated class and associated namespace

The Set also includes the associated class and associated namespace related to X;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.