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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:34:35+00:00 2026-06-11T02:34:35+00:00

template<typename T> class C { void f() { } }; /*template<typename T> void C<T*>::f()

  • 0
template<typename T>
class C
{
   void f() { }
};

/*template<typename T>
void C<T*>::f() { }*/

template<>
void C<int*>::f() { }

If we remove comment, code will not compile. I know this (and i also know, that we should have partial specialization for C<T*>), but I cannot find words in standard, which explains such behaviour. I reread 14 par of standard few times. Can you give me a quote or par of standard, that explains this?

EDIT.

template<typename T>
class C
{
   template<typename U>
   struct S { };
};
// #1
/*template<typename T>
class C<T*>
{
   template<typename U>
   struct S { };
};*/
// #2
/*template<typename T>
template<typename U>
struct C<T*>::S<U*> { };*/

template<>
template<typename U>
struct C<int*>::S<U*> { };

If we remove only comment next then #2 – code will not compile.

  • 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-11T02:34:36+00:00Added an answer on June 11, 2026 at 2:34 am

    Here is the standard quote about what may be specialized expliclitly, from 14.7.3/1:

    An explicit specialization of any of the following:

    — function template

    — class template

    — member function of a class template

    — static data member of a class template

    — member class of a class template

    — member enumeration of a class template

    — member class template of a class or class template

    — member function template of a class or class template

    can be declared by a declaration introduced by template<>;

    Unless explicitly allowed, you cannot partially specialize anything, and member functions of class templates are not explicitly allowed. Only class templates may be specialized partially (as described in 14.5.5).

    (Note that a member class template of an explicitly specialized class template is itself a class template.)

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

Sidebar

Related Questions

Here is my somewhat odd code: template <typename T&> class A { public: void
I've this class namespace baseUtils { template<typename AT> class growVector { int size; AT
I wrote this simple class that provides buffering for general output operation: template <typename
Why does this fail to compile with GCC 4.4? template<typename T> class A {
Given a class with a member template function like this one: template <typename t>
This is my template matrix class: template<typename T> class Matrix { public: .... Matrix<T>
I have the following class: template <typename T> class matrix { private: int _n;
I have the following code: class TimeOutException {}; template <typename T> class MultiThreadedBuffer {
I found this vector template class implementation, but it doesn't compile on XCode. Header
I have the following functions in class C class C { template<typename T> void

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.