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

  • Home
  • SEARCH
  • 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 8159141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:49:06+00:00 2026-06-06T17:49:06+00:00

In C++11 (or C++) is it possible to pass a template type that is

  • 0

In C++11 (or C++) is it possible to pass a template type that is not fully specified. Specifically, I want to pass a type that does not have all of its template specifiers defined yet:

template <std::size_t N, typename ARRAYTYPE>
struct A {
  ARRAYTYPE<int, N> int_array;
};

int main() {
  A<10, std::array> my_a;
  return 0;
}

I know that simply redefining ARRAYTYPE = std::array<int, 10> would work, but would not let me utilize an ARRAYTYPE of different size anywhere in A:

template <std::size_t N, typename ARRAYTYPE>
struct A {
  ARRAYTYPE<int, N> int_array;
  ARRAYTYPE<int, 1> tiny_int_array;
};

Is this possible?

  • 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-06T17:49:07+00:00Added an answer on June 6, 2026 at 5:49 pm

    It’s called a “template template parameter”, because it’s a template parameter whose value is a template:

    template <std::size_t N, template <typename, std::size_t> class ARRAYTYPE>
    struct A {
      ARRAYTYPE<int, N> int_array;
      ARRAYTYPE<int, 1> tiny_int_array;
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For a normal C++ function, it's possible to have template parameters not appearing in
i have made a template that look like this : <ControlTemplate x:Key=onoffValue TargetType={x:Type Control}>
I want to make a class that will have a single get template method
I have some class C and want to pass address of its instance and
Possible Duplicate: pass data from Action To Another Action I have a view in
Possible Duplicate: pass by reference not working I was going through some of the
Is it possible to pass a request from java servlet and read that request
Is it possible to pass *args to string.format? I have the following function: @classmethod
I have that template class that uses a policy for it's output and another
Is it possible to have multiple specializations of a variadic template where one of

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.