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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:28:03+00:00 2026-06-05T21:28:03+00:00

If this is possible, one can index into a variadic template parameter pack without

  • 0

If this is possible, one can index into a variadic template parameter pack without recursion. However, GCC is refusing to pick up my partial specialization here:

template <int I, typename List>
struct element_impl;

template <typename... TL, int... IL, typename T, int I, typename... TR, int... IR>
struct element_impl<I, typelist<pair<TL,IL>..., pair<T,I>, pair<TR,IR>...>> {
    typedef T type;
};

prog.cpp: In instantiation of ‘element<0, typelist<int, double, char,
float, long int> >
‘:
prog.cpp:52:34: instantiated from here
prog.cpp:47:79: error: invalid use of incomplete type ‘struct element_impl<0, typelist<pair<int, 0>, pair<double, 1>, pair<char, 2>, pair<float, 3>, pair<long int, 4> >‘

Is GCC buggy, or am I ignoring some limitation of variadic templates?

  • 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-05T21:28:04+00:00Added an answer on June 5, 2026 at 9:28 pm

    The spec says at 14.8.2.5p9

    If P has a form that contains <T> or <i>, then each argument Pi of the respective template argument list P is compared with the corresponding argument Ai of the corresponding template argument list of A. If the template argument list of P contains a pack expansion that is not the last template argument, the entire template argument list is a non-deduced context.

    Your typelist<T> unfortunately matches that pattern.

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

Sidebar

Related Questions

Is it possible to combine this whole definition into one declaration instead of breaking
Is it possible to convert this if statement into a one line statement ?
I know one can use an index into an array to specify length of
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
Is it possible to achieve something like this: I have one picture to set
Is it possible to use @import in one css file like this. @import file1
Is it possible, if one has a javascript variable like this: var myVariable =
I have a sortable list like this one: http://jqueryui.com/demos/sortable Is it possible to get
Just a follow up question to this one here => link Is it possible

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.