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.

219 questions
0
votes
1 answer

Getting a list of member types from a boost fusion adapted struct

I have boost fusion adapted structs like this one: struct A { int x; double y; std::string z; }; BOOST_FUSION_ADAPT_STRUCT( A, x, y, z ) I'd like to iterate over the types of the adaptation at compile time. E.g. if I…
Vladimir
  • 107
  • 2
  • 8
0
votes
2 answers

Parsing struct with enum fields and STL containers easily using Boost Spirit/Fusion

new to boost, I actually need boost spirit to write a simple parser to fill some data structure. Here are roughly what they look like: struct Task { const string dataname; const Level level; const string aggregator; const set
Nick Skywalker
  • 673
  • 6
  • 18
0
votes
1 answer

Boost fusion oddity

I am trying out Fusion and found something very odd... Here is the code... I have highlighted the problematic code with // ############ TROUBLE HERE ###### #include #include #include #include // …
zrb
  • 711
  • 1
  • 6
  • 15
0
votes
0 answers

Include counter in boost::fusion::for_each

For my current project it is necessary to iterate over a boost::fusion container. For this I found boost::fusion::for_each quite useful. Now it is necessary for me to increase a counter for each time the operator() of Functor got called. Firstly, I…
Aleph0
  • 5,058
  • 4
  • 20
  • 55
0
votes
1 answer

Getting the index of boost::fusion::vector from a boost::mpl::vector

I started to play around with the boost fusion and mpl library and got stuck with a quite simple problem. I declared the following types: typedef boost::mpl::vector TypeVector; typedef boost::fusion::vector
mkaes
  • 12,760
  • 9
  • 50
  • 67
0
votes
0 answers

boost phoenix eval failures

While trying to make a smaller reproducible case from my code base, I reach the code below. For me, it fails to compile with g++6.1 and boost 1.60 and boost develop. The grammars and rules use default types for the skipper and the other bit and only…
MMM
  • 794
  • 4
  • 19
0
votes
1 answer

Boost fusion using transform in for_each

I'm trying to build a small C++ example using boost fusion. However, Visual Studio 2013 gives me build errors for the following piece of code. It should simply go over a associative struct and print all member names to the console: #include…
bender
  • 473
  • 6
  • 14
0
votes
1 answer

Using range for on a boost FUSION sequence

I am trying to print struct members as follows: #include #include #include struct Node { int a = 4; double b =…
AlwaysLearning
  • 5,895
  • 2
  • 16
  • 50
0
votes
2 answers

Compile time switch generation based on number of fields in structure

How in C++03 get in compile time number of members of chosen struct? I was experimenting with BOOST_FUSION_ADAPT_STRUCT but I did't get any working example. I want to generate switch statement in compile time, where there will be one case per each…
Adrian
  • 71
  • 12
0
votes
2 answers

BOOST_PP_REPEAT with boost::fusion::size

I want to iterate in compile time over struct and write to output number of iteration. Just to mention - in real case I will pass some more parameters in data. #include #include #include #include…
Adrian
  • 71
  • 12
0
votes
1 answer

Merge two Boost Fusion maps based on keys

I have two boost::fusion::maps that I want to merge in a certain way. For the two maps I want to generate a third that has all the keys present in both maps and the values are added if both a present. For example: #include…
alfC
  • 10,293
  • 4
  • 42
  • 88
0
votes
2 answers

Which container types are supported by a boost::spirit parser and boost::fusion?

I'd like to ask this question on a very generic level: How far does the support of container types by boost::spirit / boost::fusion reach? Can anybody give me some generic guidance on what is possible and what is not possible? With "support" I mean…
user23573
  • 2,372
  • 1
  • 14
  • 32
0
votes
2 answers

How to create an element for each type in a typelist and add it to a vector in C++?

In C++, I 'd like to create a new element (shared_ptr) for each type specified in a typelist (and add the resulting pointers to a vector). In pseudo code, this should look similar to this: vector< shared_ptr< baseT > > v; foreach(type T:
0
votes
1 answer

How to check result from boost::fusion:at_key?

Example from boost tutorial: using namespace fields; std::string person_name = at_key(a_person); int person_age = at_key(a_person); How to check wheather there is no such key in this map?
vitperov
  • 1,182
  • 15
  • 17
0
votes
1 answer

a dictionary with compile time keys, or types as keys

Take the following "type" dictionary -- its keys are supposed to be types, and values an instance of that type: class TypeDictionary { public: template void insert(T t); template T& get(); // implementation be here --…
Nick
  • 861
  • 5
  • 11
1 2 3
14
15