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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:34:04+00:00 2026-06-05T20:34:04+00:00

One of the possible forms of template parameter is a class template. The C++

  • 0

One of the possible forms of template parameter is a class template. The C++ standard (C++2003) states that an argument for a template template parameter during the template instantiation is an “id-expression”. This non-terminal is rather wide. It allows destructors, overloaded operators, etc. For example the following code should compile fine:

template <template <typename x> class T>
struct MyClass
{
    T<int> a;
    T<double> b;
};

template <typename x> struct Helper
{
    ~Helper() { }
    x operator+(x p) { return(x[1]+p); }
    x[4] c;
};

 MyClass<Helper> p1;
 MyClass<~Helper> p2;
 MyClass<Helper::operaror+> p3;

The last 2 lines do not make any sense. But from the standpoint of the grammar they are fine. The grammar is not (and should not) describe the language exactly, but the paragraph 14.3.3, “Template template argument” does not mention any restrictions on the grammar rules in this context.

Can anybody embrace or refute my statements:

  1. Template template argument can be ONLY an identifier, maybe qualified.
  2. If point one is true, this is definitely worth mentioning in the standard.
  • 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-05T20:34:05+00:00Added an answer on June 5, 2026 at 8:34 pm

    14.3 [temp.arg] p1

    “There are three forms of template-argument, corresponding to the three forms of template-parameter: type, non-type and template. The type and form of each template-argument specified in a template-id shall match the type and form specified for the corresponding parameter declared by the template in its template-parameter-list.

    The argument ~Helper does not have the right type for the template template parameter template<typename> class T, it’s not a class template.

    14.3.3 [temp.arg.template] p1

    A template-argument for a template template-parameter shall be the name of a class template, expressed as id-expression.

    ~Helper is not the name of a class template.

    That pretty clearly rules out your examples.

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

Sidebar

Related Questions

Possible Duplicate: How to Pass String to another forms from one form in c#
One possible solution could be simple HTTP get or post request, but that wouldn't
cgi.escape seems like one possible choice. Does it work well? Is there something that
Not sure if this is possible in one Makefile alone, but I was hoping
I'm not sure if this is possible in one mysql query so I might
Given a template like template<int dim> class Point { ... }; this template can
I see here that there is a possible twig template for rendering a form
Is it possible to have multiple contact forms on one page and still validate
Is it possible one way or another to, within a Perl script, effectively execute
Is it possible for one to check the strong name of a .NET application

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.