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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:19:56+00:00 2026-05-15T03:19:56+00:00

Is there an existing function (in boost mpl or fusion) to splat meta-vector to

  • 0

Is there an existing function (in boost mpl or fusion) to splat meta-vector to variadic template arguments? For example:

splat<vector<T1, T2, ...>, function>::type
// that would be the same as
function<T1, T2, ...>

My search have not found one, and I do not want to reinvent one if it already exists.

Alternatively, is there a solution for:

apply(f, t);
// that would be the same as
f(t[0], t[1], ...);

Given f is some template function and t is a fusion sequence.

edit: after some searching I found it in http://www.boost.org/doc/libs/1_43_0/libs/fusion/doc/html/fusion/functional/invocation/functions.html

  • 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-15T03:19:57+00:00Added an answer on May 15, 2026 at 3:19 am

    You need unpack_args and quoteN, where N is the number of template arguments your template takes. Alternatively if you implement function as a metafunction class, you don’t need to quoteN. Example of a metafunction class yielding the first of two given types:

    struct function1st {
      template<typename T1, typename T2>
      struct apply { typedef T1 type; };
    };
    
    /* create a metafunction class that takes a sequence and apply it to function1st */
    typedef unpack_args<function1st> unpacker;
    

    Then you can use unpacker as a metafunction class that takes a sequence

    BOOST_MPL_ASSERT(( is_same< apply<unpacker, vector<int, char> >::type, int> ));
    

    Or if you have it as a template, you need to quote it first

    template<typename T1, typename T2>
    struct function1st { typedef T1 type; };
    
    /* create a metafunction class that takes a sequence and apply it to function1st */
    typedef unpack_args< quote2<function1st> > unpacker;
    

    Hope it helps.

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

Sidebar

Related Questions

There's an existing function that ends in the following, where d is a dictionary:
Hy there, I'm trying to adapt an existing code to boost::variant. The idea is
I want to partially specialize an existing template that I cannot change ( std::tr1::hash
I tried to modify the mini_c example of boost::spirit to match to my existing
Is there a PHP function that will do the following: Move a specified array
Is there an existing application or library in Java which will allow me to
Is there an existing solution to create a regular expressions dynamically out of a
Are there any existing solutions for remote execution of commands on a windows server
Is there any existing code in Apache HttpClient or in the servlet API to
Is there an existing PL/SQL method which takes a string and returns the same

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.