Partial template specialization - cppreference.com

July 07, 2022 | Admin |

Allows customizing class and variable (since C++14) templates for a given category of template arguments.

where class-head-name identifies the name of a previously declared class template and declarator identifies the name of a previously declared variable template (since C++14) . This declaration must be in the same namespace or, for member templates, class scope as the primary template definition which it specializes .

For example,

Examples of partial specializations in the standard library include std::unique_ptr , which has a partial specialization for array types.

The following restrictions apply to the argument-list of a partial template specialization:

Moreover, the specialization has to be more specialized than the primary template

Partial template specializations are not found by name lookup. Only if the primary template is found by name lookup, its partial specializations are considered. In particular, a using declaration that makes a primary template visible, makes partial specializations visible as well:

When a class or variable (since C++14) template is instantiated, and there are partial specializations available, the compiler has to decide if the primary template is going to be used or one of its partial specializations.

Informally "A is more specialized than B" means "A accepts a subset of the types that B accepts".

Formally, to establish more-specialized-than relationship between partial specializations, each is first converted to a fictitious function template as follows:

The function templates are then ranked as if for function template overloading.

The template parameter list and the template argument list of a member of a partial specialization must match the parameter list and the argument list of the partial specialization.

Just like with members of primary templates, they only need to be defined if used in the program.

Members of partial specializations are not related to the members of the primary template.

Explicit (full) specialization of a member of a partial specialization is declared the same way as an explicit specialization of the primary template.

If a primary template is a member of another class template, its partial specializations are members of the enclosing class template. If the enclosing template is instantiated, the declaration of each member partial specialization is instantiated as well (the same way declarations, but not definitions, of all other members of a template are instantiated).

If the primary member template is explicitly (fully) specialized for a given (implicit) specialization of the enclosing class template, the partial specializations of the member template are ignored for this specialization of the enclosing class template.

If a partial specialization of the member template is explicitly specialized for a given (implicit) specialization of the enclosing class template, the primary member template and its other partial specializations are still considered for this specialization of the enclosing class template.

The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

Related Posts

Best Free Online Microsoft Office Training Courses

Jan 18, 2022  · 2. Microsoft Courses – [Coursera] If you have heard about online learning, there may not be any one of you who has not heard about Coursera. Like Udemy, even Coursera is one of the best websites to learn Microsoft Office. A great thing about Coursera is that it has Microsoft free courses online along with paid option.

 

In today’s technology-driven world, Microsoft Office is one of the most vital requirements in the business environment. Your proficiency with Microsoft Office gives you a bankable advantage. However, stating you are adept at it will imply your excellence in each of the Office applications and some advanced techniques in the other more prevalent apps.

 

To be well-versed with all the apps, you need to have practical training with MS Office tools. Today, you can...

Read more >>

AP Statistics – AP Students | College Board

May 05, 2022  · College Course Equivalent. A one-semester, introductory, non-calculus-based college course in statistics. Recommended Prerequisites. A second-year course in algebra. Exam Date Thu, May 5, 2022, ... AP Statistics Course and Exam Description This is the core document for the course. It clearly lays out the course content and describes the exam ...

Learn all about the course and exam. Already enrolled? Join your class in My AP.

Go to AP Central for resources for teachers, administrators, and coordinators.

Learn about the major concepts and tools used for collecting, analyzing, and drawing conclusions from data. You’ll explore statistics through discussion and activities, and you'll design surveys and experiments.

Selecting methods for collecting or analyzing data

Describing patterns, trends, associations, and...

Read more >>

Baking & Pastry Classes - Institute of Culinary Education

The Institute of Culinary Education offers the nation's largest selection of hands-on cooking, baking, and wine courses. Classes are offered day and night 355 days of the year. Your gift recipient can choose the topic, menu and time schedule that is perfect for their appetite! ICE Gift Cards are available for purchase online and at the school.

We have updated our Privacy Policy and encourage you to review the updated policy here By clicking Accept, you confirm that you have read and agree to the Terms of Use and privacy policy

Welcome, Guest!

Whisk, knead and frost your way through our comprehensive collection of pastry and baking classes. You’ll learn techniques like...

Read more >>

Cybersecurity Certification Training Courses and Classes | ONLC

Cybersecurity Training Classes & Certification. Get the cybersecurity training needed to guard computer systems against emerging threats and to safeguard a company's IT environment …

Get the cybersecurity training needed to guard computer systems against emerging threats and to safeguard a company's IT environment with classes from ONLC Training Centers. Many of these certifications are DoD Directive 8140 / 8570.1 approved.

Cybersecurity professionals are needed in every industry for companies of all sizes to protect their systems against attacks and data breaches. The demand for qualified cybersecurity professionals is one of the fastest growing fields...

Read more >>