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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:21:55+00:00 2026-06-14T00:21:55+00:00

I am trying to generate some generic configuration handling code that maps indexes to

  • 0

I am trying to generate some generic configuration handling code that maps indexes to types, using a fusion::map with an internal format as follows:

fusion::pair< mpl::int_< VALUE >, type >;

To simplify generation of the map I have the following code:

#include <boost/fusion/sequence.hpp>
#include <boost/fusion/container.hpp>
#include <boost/fusion/algorithm.hpp>

#include <boost/mpl/int.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/map.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/is_reference.hpp>
#include <boost/mpl/for_each.hpp>
#include <boost/mpl/placeholders.hpp>

#include <typeinfo>
#include <string>
#include <iostream>

/// create a fusion map of all parameter data
namespace fusion = boost::fusion;
namespace mpl = boost::mpl;

template < unsigned Idx, typename T >
struct config_param
{
    typedef mpl::int_< Idx > index_value;
    typedef T value_type;
};

template< class T >
struct to_fusion_pair
{
    typedef fusion::pair< typename T::index_value
                        , typename T::value_type > type;
};

typedef mpl::vector< config_param< 10, unsigned >
                   , config_param< 20, std::string >
                   , config_param< 30, bool >
                   , config_param< 40, long >
                   , config_param< 50, std::string >
                   > MySequence;

typedef mpl::transform< MySequence, to_fusion_pair< mpl::_1 > >::type ConvertedSeq;

This compiles and produces the expected results, unfortunately if I try to wrap the call to transform, I get a large number of errors. i.e:

template< class Seq >
struct to_vector_of_fusion_pair
{
    typedef mpl::transform< Seq, to_fusion_pair< mpl::_1 > >::type type;
};

typedef to_vector_of_fusion_pair<MySequence>::type ConvertedSeq2;

The compiler errors are as follows:

fusion-db.cpp:40: error: type boost::mpl::transform<Seq, to_fusion_pair<mpl_::arg<1> >, mpl_::na, mpl_::na> is not derived from type to_vector_of_fusion_pair<Seq>â
fusion-db.cpp:40: error: expected ; before type

What is wrong with my to_vector_of_fusion_pair structure that makes it incompatible with mpl::transform?

  • 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-14T00:21:57+00:00Added an answer on June 14, 2026 at 12:21 am
    template< class Seq >
    struct to_vector_of_fusion_pair
    {
        typedef typename mpl::transform< Seq, to_fusion_pair< mpl::_1 > >::type type;
    };
    

    Read this for explanations Where and why do I have to put the "template" and "typename" keywords?

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

Sidebar

Related Questions

I am trying to generate some code using Acceleo. I am constructing my model
I am trying to generate some code using CodeDom. I wanted to know if
I am trying to write some code that will generate accurate .proto files from
I am trying to generate some Javascript for a Comet callback. The code that
I am trying to generate some code at runtime using the DynamicMethod class in
I'm trying to generate some html programmatically in my code behind for a user
I'm trying to generate some stubs for a WSDL (using xmlbeans) and keep running
I'm having some problems trying to figure out how to generate a Google Map
I am trying to port some code form java do F# that generates a
I am trying to generate code on every build of my project using VS2012.

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.