Questions tagged [boost-fusion]

Boost.Fusion is a library for working with heterogenous collections of data, commonly referred to as tuples.

Boost.Fusion is a library for working with heterogenous collections of data, commonly referred to as tuples. A set of containers (vector, list, set and map) is provided, along with views that provide a transformed presentation of their underlying data. Collectively the containers and views are referred to as sequences, and Fusion has a suite of algorithms that operate upon the various sequence types, using an iterator concept that binds everything together.

222 questions
2
votes
1 answer

How can I get the type of a value in boost::fusion::map?

I am using boost fusion. I want to declare a template function that assigns to a field of a map and performs various other functions. I cannot for the life of me work out how to get the type of an element stored in a fusion::map. I am sure it is…
user1759557
  • 445
  • 4
  • 12
2
votes
2 answers

Boost Fusion: validate adapted struct member ordering at compile time

I'm using BOOST_FUSION_ADAPT_STRUCT(), and I need to check that all the members are declared and in the correct order. So first I did this: template struct checker { static void check() { typedef typename…
John Zwinck
  • 239,568
  • 38
  • 324
  • 436
2
votes
2 answers

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

Edit: This turned out to be an issue with temporaries. Basically, I was ignorantly using C++ as if it worked like Java or C#, which it does not. Hopefully, this will be a good cautionary tale. Edit: This issue only seems to happen with the…
Brett Rossier
  • 3,420
  • 3
  • 27
  • 36
2
votes
1 answer

boost fusion why there is different result in c++11 and c++03?

Why the following type as_vet_type is boost::fusion::vector2 when compiling with C++03 and boost::fusion::vector when compiling with c++11 ? const is missing with c++11. Is this a bug or feature ? I tested this with…
naroj
  • 31
  • 4
2
votes
2 answers

Extracting a tuple of value_type from a tuple of containers in C++11

I have a function with a template parameter which I know to be a std::tuple of several standard C++ containers of varying element types. How can I extract, out of this, a type that is a std::tuple of the element types? For example, suppose I have…
2
votes
2 answers

Pointers to class members when iterating with boost::fusion

I have a boost::graph that uses bundled properties like the following: struct Vertex { std::string id; }; If I want to use this information in boost::dynamic_properties (e.g. for printing in graphml-format), I can use something like…
Slizzered
  • 869
  • 2
  • 9
  • 23
2
votes
0 answers

C++ Access struct member by string reference [reflection]

Say I have a struct like the following: struct employee { std::string name; int age; }; With boost fusion I can decorate the struct: BOOST_FUSION_ADAPT_ASSOC_STRUCT( demo::employee, (std::string, name) (int, age) ) And access…
0xFF
  • 4,140
  • 7
  • 41
  • 58
2
votes
1 answer

boost::spirit parsing into struct with std::array

I'm using boost::spirit to parse text into a struct containing a fixed size array. While following the example in qi/boost_array.cpp and trying to use it for parsing into a struct containing a std::array (or a boost::array) i recognised that because…
wonko realtime
  • 545
  • 9
  • 26
2
votes
1 answer

c++/boost fusion handle parent class

Lets suppose I have such classes hierarchy: enum class Type { DUMMY }; struct Base { int a; explicit Base(int a) : a(a) {} virtual ~Base() {} virtual Type type() = 0; }; struct Foo1 : public Base { double b; Foo1(int a, double b) :…
fghj
  • 8,898
  • 4
  • 28
  • 56
2
votes
0 answers

BOOST_FUSION_ADAPT_STRUCT with two template parameters

Here is a coliru of the error: http://coliru.stacked-crooked.com/a/a03c61dc0c33c94b I have a type with two template parameters like so: template class DoubleTemplate {}; In a struct I have a member of the above type like…
Cory-G
  • 1,025
  • 14
  • 26
2
votes
2 answers

Where can I find boost::fusion articles, examples, guides, tutorials?

I am going to go ahead and shamelessly duplicate this question because the accepted answer is essentially "nope, no guides" and it's been nearly a year now since it's been asked. Does anyone know of any useful articles, guides, tutorials, etc. for…
Kyle
  • 4,487
  • 3
  • 29
  • 45
2
votes
1 answer

Boost Fusion: Nesting flatten_view and zip_view

Hi! I'm desperately trying to nest different views using Boost Fusion. I'm still in the process of learning Fusion, so apologies if this is a silly question. My actual scenario is much more complex, but I'll try to simplify it as much as possible…
bch
  • 23
  • 3
2
votes
1 answer

boost fusion copy smaller sequence into larger sequence

Up until now, i was copying a src fusion sequence into a dst fusion sequence. struct Dst { ... } dst; boost::fusion::copy( src, dst ); However, dst, which is a struct adapted as a fusion sequence has a new member, placed last. src's size has not…
MMM
  • 910
  • 1
  • 9
  • 25
2
votes
1 answer

boost::fusion::invoke compiler error with Visual Studio 2013

Trying to compile the following call to boost::fusion::invoke in boost-1.56 fails in Visual Studio 2013 but there is no error when compiling with Visual Studio 2012. #include #include #include…
fun4jimmy
  • 672
  • 4
  • 16
2
votes
1 answer

boost fusion: strange problem depending on number of elements on a vector

I am trying to use Boost::Fusion (Boost v1.42.0) in a personal project. I get an interesting error with this code: #include "boost/fusion/include/sequence.hpp" #include "boost/fusion/include/make_vector.hpp" #include…
chaos.ct
  • 1,001
  • 1
  • 7
  • 18