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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:10:06+00:00 2026-05-31T18:10:06+00:00

For example, this is the declaration of boost::tuple // – tuple forward declaration ———————————————–

  • 0

For example, this is the declaration of boost::tuple

// - tuple forward declaration -----------------------------------------------
template <
  class T0 = null_type, class T1 = null_type, class T2 = null_type,
  class T3 = null_type, class T4 = null_type, class T5 = null_type,
  class T6 = null_type, class T7 = null_type, class T8 = null_type,
  class T9 = null_type>
class tuple;

As expected, I get the following error if I try to use more number of arguments

$ g++ vec.cc 
vec.cc: In function 'int main()':
vec.cc:6: error: wrong number of template arguments (12, should be 10)
/usr/include/boost/tuple/detail/tuple_basic.hpp:75: error: provided for 'template<class T0, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8, class T9> class boost::tuples::tuple'
vec.cc:6: error: template argument 1 is invalid
vec.cc:6: error: template argument 2 is invalid
vec.cc:6: error: invalid type in declaration before ';' token
$

Is there a way to declare the class so that it accepts any number of template arguments?

  • 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-31T18:10:08+00:00Added an answer on May 31, 2026 at 6:10 pm

    C++11 supports variadic templates. These allow you to write:

    template<typename ...Args>
    class tuple
    {
        // ...
    };
    

    However, there is no simple way to iterate over the arguments of a variadic template. See the linked article for several workarounds for this problem.

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

Sidebar

Related Questions

I would like an explanation of difference for example between this declaration: class Clazz(param1:
Consider this classic example used to explain what not to do with forward declarations:
How i can get full right name of generic type? For example: This code
example: at this domain http://www.example.com/234234/go.html is only one iframe-code how can i get the
Example: // can't forward declare with class Foo::Bar // actual class class Foo {
In the following code I have placed anonymous structures inside of my class declaration
Taking for example this method declaration: const Vector Vector::operator - ( const Vector& other
I'm trying to follow this example http://www.boost.org/doc/libs/1_42_0/libs/serialization/doc/serialization.html#constructors but I keep getting errors. Following the
While looking at the Timer documentation I ran across the following example with this
I came across this example from Accelerated C++ vector<string> func(const string&); //function declaration vector<string>

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.