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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:13:28+00:00 2026-05-23T16:13:28+00:00

#include <iostream> #include <boost/fusion/mpl.hpp> #include <boost/fusion/include/mpl.hpp> #include <boost/fusion/container/set.hpp> #include <boost/fusion/include/at_key.hpp> #include <boost/fusion/include/as_set.hpp> #include <boost/mpl/vector.hpp>

  • 0
#include <iostream>
#include <boost/fusion/mpl.hpp>
#include <boost/fusion/include/mpl.hpp>
#include <boost/fusion/container/set.hpp>
#include <boost/fusion/include/at_key.hpp>
#include <boost/fusion/include/as_set.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/set.hpp>
#include <boost/mpl/front.hpp>
#include <boost/mpl/fold.hpp>
#include <boost/mpl/placeholders.hpp>
#include <boost/mpl/insert.hpp>    

struct node_base
{
    int get() {return 123;}
};
struct node_a : public node_base
{};
struct node_b : public node_base
{};
struct node_c : public node_base
{};

typedef boost::mpl::vector3<
::boost::mpl::vector1<node_a>
,::boost::mpl::vector1<node_b>
,::boost::mpl::vector1<node_c>
>::type nested_vec_type;

typedef ::boost::mpl::fold<
nested_vec_type
, ::boost::mpl::set<>
, ::boost::mpl::insert< 
    ::boost::mpl::placeholders::_1
    , ::boost::mpl::front<::boost::mpl::placeholders::_2>
>
>::type restored_set_type;

typedef ::boost::fusion::result_of::as_set<restored_set_type> restored_fusion_set;

restored_fusion_set my_restored_set;

int main()
{
    std::cout << boost::fusion::at_key<node_a>(my_restored_set).get() << std::endl;
    std::cout << boost::fusion::at_key<node_b>(my_restored_set).get() << std::endl;
    std::cout << boost::fusion::at_key<node_c>(my_restored_set).get() << std::endl;
    return 0;
}



error C2039: 'category' : is not a member of 'boost::fusion::result_of::as_set<Sequence>'
error C2039: 'type' : is not a member of 'boost::fusion::result_of::end<Sequence>'
error C2504: 'boost::fusion::extension::end_impl<Tag>::apply<Sequence>' : base class undefined
error C2039: 'type' : is not a member of 'boost::fusion::result_of::begin<Sequence>'
error C2504: 'boost::fusion::extension::begin_impl<Tag>::apply<Sequence>' : base class undefined
error C2065: 'type' : undeclared identifier

The conversions from simple mpl sequences like ::boost::mpl::vector< node_a, node_b, node_c > to fusion sequences work fine.
But I got compile-time errors when I was trying to convert a after-processed mpl sequence from a complex mpl sequence (like nested mpl vectors) to a fusion sequence (through result_of::as_set or as_vector).

The print out of “restored_set_type” is:

struct node_c
struct node_b
struct node_a

, but it seems to lose some type information, which makes it different from a simple mpl sequence ::boost::mpl::vector< node_c, node_b, node_a > .

Did I miss anything to specify, like tag, size, or? 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-23T16:13:28+00:00Added an answer on May 23, 2026 at 4:13 pm

    the solution is a lot simpler than it first appears! 🙂

    You’ve missed out something critical:

    typedef ::boost::fusion::result_of::as_set<restored_set_type> restored_fusion_set;
    

    Is incorrect, what you need is:

    typedef ::boost::fusion::result_of::as_set<restored_set_type>::type restored_fusion_set;
    

    You simply missed ::type hence the type of restored_fusion_set is actually as_set<restored_set_type> – which is not what is required.

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

Sidebar

Related Questions

I can't understand why the code behaves this way? #include <iostream> #include <boost/fusion/container/vector.hpp> #include
#include <tuple> #include <vector> #include <string> #include <iostream> //------------------------------------------------------------------------- #include <boost/spirit/include/karma.hpp> #include <boost/fusion/adapted/std_tuple.hpp> //-------------------------------------------------------------------------
I have the following code and it works fine. #include <boost\mpl\vector.hpp> #include <boost\mpl\fold.hpp> #include
Why this code does not compile: #include <boost/mpl/vector.hpp> #include <boost/mpl/for_each.hpp> #include <iostream> using namespace
#include <iostream> #include <algorithm> #include <vector> #include <boost/array.hpp> #include <boost/bind.hpp> int main() { boost::array<int,
Consider the following : #include <vector> #include <string> #include <iostream> #include <boost/format.hpp> #include <boost/assign.hpp>
#include <boost/algorithm/string.hpp> #include <vector> #include <iostream> #include <string> using namespace std; using namespace boost;
Given this code: #include <iostream> #include <vector> #include <fstream> #include <sstream> #include <boost/regex.hpp> using
Consider following example: #include <iostream> #include <functional> #include <algorithm> #include <vector> #include <boost/bind.hpp> const
Consider following example. #include <iostream> #include <algorithm> #include <vector> #include <boost/bind.hpp> void func(int e,

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.