boost-fusion

Boost Fusion articles, examples, tutorials?

Do you know any good resources/articles/examples of boost::fusion library usage? Boost Fusion looks extremely interesting, I think I understand how it works and how to use the basics, but I'm looking for some resources that show any interesting usage/practices e.g. articles or blogs (apart from boost.org itself). ...

generate mpl::vector from fusion::vector

How to generate fusion::vector from mpl::vector? How to generate mpl::vector from fusion::vector? BOOST_MPL_ASSERT((is_same< fusion::vector<int, char>, generate_fusion_vector<mpl::vector<int, char> >::type >)); BOOST_MPL_ASSERT((is_same< mpl::vector<int, char>, gen...

What is the proper use of boost::fusion::push_back?

// ... snipped includes for iostream and fusion ... namespace fusion = boost::fusion; class Base { protected: int x; public: Base() : x(0) {} void chug() { x++; cout << "I'm a base.. x is now " << x << endl; } }; class Alpha : public Base { public: void chug() { x += 2; cout << "Hi, I'm an ...

How to use boost::fusion::transform on heterogeneous containers?

Boost.org's example given for fusion::transform is as follows: struct triple { typedef int result_type; int operator()(int t) const { return t * 3; }; }; // ... assert(transform(make_vector(1,2,3), triple()) == make_vector(3,6,9)); Yet I'm not "getting it." The vector in their example contains elements all of...

Boost.Fusion Functional: Calling functions with default arguments

Is it possible to use boost::fusion::invoke function to call a function that has default arguments without specifying those? Example: void foo(int x, int y = 1, int z = 2) { std::cout << "The sum is: " << (x + y + z) << std::endl; } ... // This should call foo(0). It doesn't work because the type of foo is void (*) (int, int, int)....

How can I parse different structures with Boost.Spirit.Qi?

In this example, employee structs are parsed in the form "employee{int, string, string, double}". I would like to know whether it is possible to modify this example to also parse different types of structs, like "intern{int, string, string}". Specifically, I would like to then pass the structure to a function overloaded on the structur...

Boost Fusion container of shared pointers (shared_ptr) causing Segmentation Fault (sigsegv) or garbage results

Edit: This issue only seems to happen with the combination of joint_view and shared_ptr. Raw pointers seem to work fine in the same scenario, as do shared pointers in a plain fusion container constructed w/ all its items at once, without adding anything more to it. Details below: I'm using mingw gcc 4.5.1 Running into a peculiar issue...