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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:08:56+00:00 2026-05-14T14:08:56+00:00

I was playing around with variadic templates (gcc 4.5) and hit this problem :

  • 0

I was playing around with variadic templates (gcc 4.5) and hit this problem :

template <typename... Args>
boost::tuple<Args...>
my_make_tuple(Args... args)
{
   return boost::tuple<Args...>(args...);
}

int main (void)
{
    boost::tuple<int, char> t = my_make_tuple(8, 'c');
}

GCC error message :

sorry, unimplemented: cannot expand 'Arg ...' into a fixed-length argument list
In function 'int my_make_tuple(Arg ...)'

If I replace every occurrence of boost::tuple by std::tuple, it compiles fine.
Is there a problem in boost tuple implementation? Or is this a gcc bug ?

I must stick with Boost.Tuple for now. Do you know any workaround ?
Thanks.

  • 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-14T14:08:57+00:00Added an answer on May 14, 2026 at 2:08 pm

    It doesn’t seem to like expanding Args... to T1, T2, T3, ..., T9 as Boost has it.

    As a workaround, use constructs that don’t require this expansion:

    #include <boost/tuple/tuple.hpp>
    
    template <typename... Args>
    auto my_make_tuple(Args... args) -> decltype(boost::make_tuple(args...))
    {
       return {args...};
    }
    
    int main (void)
    {
        boost::tuple<int, char> t = my_make_tuple(8, 'c');
    }
    

    Another option might be to do the expanding manually, seeing that boost::tuple supports up to 10 arguments.

    #include <boost/tuple/tuple.hpp>
    
    template <unsigned, class, class...> struct nth_argument;
    
    template <unsigned N, class Default, class T, class... Args>
    struct nth_argument<N, Default, T, Args...>
    {
        typedef typename nth_argument<N - 1, Default, Args...>::type type;
    };
    
    template <class Default, class T, class... Args>
    struct nth_argument<0, Default, T, Args...>
    {
        typedef T type;
    };
    
    template <unsigned N, class Default>
    struct nth_argument<N, Default>
    {
        typedef Default type;
    };
    
    template <typename ...Args>
    struct tuple_from_var_template
    {
        typedef boost::tuple<
            typename nth_argument<0, boost::tuples::null_type, Args...>::type,
            typename nth_argument<1, boost::tuples::null_type, Args...>::type,
            typename nth_argument<2, boost::tuples::null_type, Args...>::type,
            typename nth_argument<3, boost::tuples::null_type, Args...>::type,
            typename nth_argument<4, boost::tuples::null_type, Args...>::type,
            typename nth_argument<5, boost::tuples::null_type, Args...>::type,
            typename nth_argument<6, boost::tuples::null_type, Args...>::type,
            typename nth_argument<7, boost::tuples::null_type, Args...>::type,
            typename nth_argument<8, boost::tuples::null_type, Args...>::type,
            typename nth_argument<9, boost::tuples::null_type, Args...>::type
        > type;
    };
    
    template <typename... Args>
    typename tuple_from_var_template<Args...>::type my_make_tuple(Args... args)
    {
       return typename tuple_from_var_template<Args...>::type(args...);
    }
    
    int main (void)
    {
        boost::tuple<int, char> t = my_make_tuple(8, 'c');
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.