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
1
vote
0 answers

Get subset of fusion::set with types from mpl::vector

Given a fusion::set and an mpl::vector, what's the easiest way to obtain a view of the set with types specified by the vector? Is there some built-in way to do it without manually writing index sequence etc?
lizarisk
  • 7,562
  • 10
  • 46
  • 70
1
vote
1 answer

Binding a pretty-printer to boost::phoenix actors when iterating with boost::fusion

This question is a follow-up to Pointers to class members when iterating with boost::fusion, where the accepted solution works. Now, I want not only to add the (primitive) values to the property-map, but use a pretty-printer to improve how the…
Slizzered
  • 869
  • 2
  • 9
  • 23
1
vote
1 answer

Adapting define/include generated struct to boost::fusion

I have a legacy structure that is defined in such a way: // file:MyStructure_def.h STRUCT_BEGIN STRUCT_FIELD(int,x) STRUCT_END // EOF // file: MyStructure.h #define STRUCT_BEGIN struct MyStructure{ #define STRUCT_FIELD(a,b) a b; #define STRUCT_END…
nkdm
  • 1,220
  • 1
  • 11
  • 26
1
vote
1 answer

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…
Karel Petranek
  • 15,005
  • 4
  • 44
  • 68
1
vote
4 answers

How to write a for loop for a Hana sequence?

I have a Boos.Hana sequence and I would like to print it to screen separated by commas. However the commas separate elements only, so I have to check if I am at the last element. Currently my hack is pretty bad (looking at the pointer and casting…
alfC
  • 14,261
  • 4
  • 67
  • 118
1
vote
1 answer

Spirit::Boost compilation error possibly related to single element fusion sequence

When I compile the following code I get this error: boost\spirit\home\qi\detail\assign_to.hpp(164): error C2440: 'static_cast' : cannot convert from 'const wchar_t' to 'element_type' The comment right above line 164 reads as follows: // This…
Sakuragaoka
  • 177
  • 1
  • 8
1
vote
0 answers

Runtime iteration over tuple types without construction

I have a std::tuple (or a boost fusion tuple) whose elements cannot be trivially constructed (for example references) and I want to iterate over the types but not the values of the elements. In this example I have a (general) tuple type and I want…
alfC
  • 14,261
  • 4
  • 67
  • 118
1
vote
1 answer

boost::spirit arithmetic formulas parser fails to compile

I am trying to write a spirit parser for arithmetic expression which fills an abstract syntax tree. The parser compiles if I am not trying to fill the AST, but fails (with one 24K error) in the current version. I am using clang++ 3.5.0 with…
David Lehavi
  • 1,186
  • 7
  • 16
1
vote
1 answer

Boost Spirit Parser with a vector of three strings compiling into a struct, adapt not working

I´m a student and need to write a Parser in C++ with the Boost-Library. Therefore I write a grammer in QI because I need to parse into a struct. So far, so good. I will give you some example-code. I think it is easier than writing the whole…
William Wallace
  • 89
  • 3
  • 12
1
vote
1 answer

Runtime find first match in boost::mpl::vector

I have a boost::mpl::vector and now would need a template (function), which "iterates" over the types until the first match (at runtime) is found. Something similar to boost::fusion::find_if, but without sequence being a runtime value. Would image…
abergmeier
  • 13,224
  • 13
  • 64
  • 120
1
vote
1 answer

Spirit karma grammar issue when one rule uses BOOST_FUSION_ADAPT_STRUCT

I am trying to create a Spirit Karma grammar that is composed of several rules. This grammar is intended to create a string of the format "(0, 1, 2, 3), (4, 5, 6, 7), (8, 9, 10, 11)". The rule to print out each individual struct that I call RowData…
Enginerd
  • 21
  • 4
1
vote
2 answers

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()) ==…
Kyle
  • 4,487
  • 3
  • 29
  • 45
1
vote
1 answer

Boost fusion error in substituting the adt_proxy type to the value type

I am trying to write a XML serializer and de-serializer for user defined classes. Please refer to the code posted in Coliru The deserializer i am unable to get the type resolved from the adt_proxy to the value type in question. The error is the…
balas bellobas
  • 237
  • 3
  • 12
1
vote
2 answers

parsing into classes (not structs)

below I show an edited spirits employee example which does not compile. The problem I want to solve is to parse into classes not structs. I know, it's quite the same besides public/private. But I need to have a constructor to work before storing the…
user1587451
  • 978
  • 3
  • 15
  • 30
1
vote
1 answer

C++ Register class member var's at compile time

I try to implement a Java-Like annotation system using boost MPL and fusion. Why is it needed: I need to annotate member var's to have some special runtime features. I register try them at compile time to my base clase like this: class foo { …
Matyro
  • 151
  • 1
  • 9