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
4
votes
1 answer

Nested Boost Fusion Structs

Is it possible to define (or adapt) a Boost Fusion struct that contains member Boost Fusion structs in a single statement? For example, how can I adapt or define something equivalent to this: struct Outer { int i; float j; struct Nested …
Adi Shavit
  • 16,743
  • 5
  • 67
  • 137
4
votes
2 answers

Boost Fusion: convert adapted struct type to text

Given a struct like this: struct Foo { int x; int y; double z; }; BOOST_FUSION_ADAPT_STRUCT(Foo, x, y, z); I want to generate a string like this: "{ int x; int y; double z; }" I have seen how to print the values of a Fusion…
John Zwinck
  • 239,568
  • 38
  • 324
  • 436
4
votes
1 answer

Matching a sequence of two integers into an `std::pair`

I'm trying to use Boost.Sprit x3 to match a sequence of two integers into an std::pair. Judging by the documentation, the following code should compile: #include #include #include…
Vittorio Romeo
  • 90,666
  • 33
  • 258
  • 416
4
votes
1 answer

Boost Fusion transform type manipulation and as_vector

I am trying to get the point of using Fusion and am stumped with this simple example: #include #include #include #include…
Engineerist
  • 367
  • 2
  • 13
4
votes
1 answer

C++ map of string as key and type as value

Is there an alternative to boost-hana in boost library which will allow me to create something like typedef boost::AlterinativeToHana::map< make_pair<"abcd",ABCDType>, make_pair<"efgh",EFGHType>, …
Recker
  • 1,915
  • 25
  • 55
4
votes
1 answer

Making FUSION work to display the contents of a structure

The purpose of the following code is to display the contents of a structure. It is based on this answer. #include #include #include #include…
AlwaysLearning
  • 7,257
  • 4
  • 33
  • 68
4
votes
1 answer

BOOST_FUSION_ADAPT_TPL_STRUCT with template members

I am new to StackOverflow and new to writing macro in c++, please forgive me if this question is too naive. I have written a template class like this: template class Foo { public: unsigned n; …
4
votes
1 answer

Fusion adaped std_tuple views, conversion to another tuple

Boost Fusion has been designed in such a way that most of the transformations are "lazy", in the sense that they all generate "views" but not actual (Fusion) containers…
alfC
  • 14,261
  • 4
  • 67
  • 118
4
votes
1 answer

MPL replace without casting the fusion container

I have this class struct MyChildrenNeedsSpace : HaveChildren { typedef childrenListType context; const context children; MyChildrenNeedsSpace() : children("this", "sentence",…
4
votes
2 answers

How to convert a homogeneous fusion::vector to an (std/boost)::array

I am relatively new to boost, so I believe this is an easy problem: Given, say a fusion::vector, I need a good way to turn it into an array.
iolo
  • 1,090
  • 1
  • 9
  • 20
4
votes
1 answer

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…
Kyle
  • 4,487
  • 3
  • 29
  • 45
4
votes
1 answer

boost::fusion::zip function vs boost::fusion::zip_view

I'm painfully trying to learn boost fusion and I dont understand clearly the differences between zip_view and the result of zip function. namespace fuz = boost::fusion; typedef fuz::vector vec1; typedef fuz::vector vec2; typedef…
Laurent
  • 812
  • 5
  • 15
4
votes
1 answer

Why does Boost.Spirit correctly parse an identifier into a std::string, but not into an adapted struct consisting solely of std::string?

I have defined a rule for an identifier: start with an alpha character, followed by any number of alpha-numeric characters. I have differing results when I parse directly into a std::string versus an adapted struct containing a single…
GManNickG
  • 494,350
  • 52
  • 494
  • 543
4
votes
1 answer

boost::spirit compile error when lexer tokens > 10

when i try and compile the following code i get a compile fail (error C2903: 'apply' : symbol is neither a class template nor a function template ...) when token_list > 10 tokens. The code compiles and parses correctly when tokens <= 10. Is there a…
user2149346
  • 295
  • 1
  • 8
4
votes
1 answer

Boost spirit parse integer to custom list template

I have trouble with boost spirit to parse a file like that : int [int, int, int] [ int, int] ... Nothing really hard, the following grammar works for that: template struct parser_expression :…
sexyslippers69
  • 334
  • 2
  • 9
1 2
3
14 15