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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:05:51+00:00 2026-05-27T14:05:51+00:00

Users are allowed to add explicit specializations to the std namespace. However, there are

  • 0

Users are allowed to add explicit specializations to the std namespace. However, there are a few templates that I am explicitly forbidden from specializing.

What templates can and can’t I specialize?

  • 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-27T14:05:51+00:00Added an answer on May 27, 2026 at 2:05 pm

    Quoting loosely from the standard:

    • numeric_limits shall not be specialized for non-arithmetic standard types (e.g. complex<T>)

    • "[S]pecializations of shared_ptr shall be CopyConstructible, CopyAssignable, and LessThanComparable [and] convertible to bool."

    • "Specializations of weak_ptr shall be CopyConstructible and CopyAssignable."

    • "[T]emplate specializations [of std::hash] shall meet the requirements of class template hash."

    • Anything in <type_traits>: "The behavior of a program that adds specializations for any of the class templates defined in this subclause is undefined unless otherwise specified." (only some specializations of common_type are explicitly allowed)

    • Locales have certain required specializations.

    • All specializations of istreambuf_iterator shall have a trivial copy constructor, a constexpr default constructor, and a trivial destructor.

    • "The effect of instantiating the class template complex for any type other than float, double, or long double is unspecified." I take it that means that defining such other specializations is pointless.

    • "Specializations and instantiations of the atomic template shall have a deleted copy constructor, a deleted copy assignment operator, and a constexpr value constructor."

    • "The class templates unary_function and binary_function are deprecated. A program shall not declare specializations of these templates."

    And of course the overarching clause 17.6.4.2.1, sentence 1 (thanks @sehe and @curiousguy):

    The behavior of a C++ program is undefined if it adds declarations or definitions to namespace std or to a
    namespace within namespace std unless otherwise specified. A program may add a template specialization
    for any standard library template to namespace std only if the declaration depends on a user-defined type
    and the specialization meets the standard library requirements for the original template and is not explicitly
    prohibited.

    And sentence 2:

    The behavior of a C++ program is undefined if it declares

    • an explicit specialization of any member function of a standard library class template, or

    • an explicit specialization of any member function template of a standard library class or class template, or

    • an explicit or partial specialization of any member class template of a standard library class or class template.

    A program may explicitly instantiate a template defined in the standard library only if the declaration
    depends on the name of a user-defined type and the instantiation meets the standard library requirements
    for the original template.

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

Sidebar

Related Questions

I'm working on a site where users can add points to other user, however
Let's say that there are multiple users in my office that need access to
Currently I'm allowed users to add application/x-shockwave-flash objects to their profiles in my website.
I have a table of items that users are allowed to vote on. In
I am working on an application that allows users to dynamically add questions to
We have a situation where users are allowed to upload content, and then separately
I've been assigned a project for a website where users will be allowed to
I have a requirement that a user is allowed only to enter string value
How do I create a MS SQL server user that only allowed to read
Users are pasting text from Lotus Notes into my VBA application. This is then

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.