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
2 answers

Find the index of an element in a fusion map

I am struggling with a small piece of functionality I'm looking for. I have a class which contains a fusion::map. I would like to use a variadic constructor to initialise the elements in that map. I expect the easiest way to do this is to construct…
Steve Lorimer
  • 27,059
  • 17
  • 118
  • 213
2
votes
1 answer

Boost Fusion invoke and SFINAE

I would like to achieve partial class template specialization based on whether boost::fusion::invoke() with a particular Fusion sequence would work or not. But it seems that substitution failure in this case IS an error. I guess I need an…
paperjam
  • 8,321
  • 12
  • 53
  • 79
1
vote
1 answer

Filling up std::vector with heterogeneous boost::fusion vector type data

I am new to boost and metaprogramming so my problem is this: typedef fusion::vector my_row; typedef std::vector my_vec; my_row my_data = my_row(3,"f",2,"2"); my_vec t; t.push_back(my_data); // this doesn't…
chara
  • 73
  • 5
1
vote
0 answers

issues with const correctness using boost::fusion::map

I'm writing some classes that use boost::fusion::map. Bellow you find a simplified code: template struct Object { typedef typename boost::fusion::result_of::as_map::type map_type; map_type…
sinad
  • 137
  • 10
1
vote
2 answers

Initializing the elements of a Boost.Fusion sequence from another sequence

I've got a Boost.Fusion sequence of elements that need to be initialized one each with the elements of another sequence. When I'd not use Fusion, this would look like: class A { A1 a; A2 b; A3 c; }; class B { B1 a; B2 b; B3…
thiton
  • 35,651
  • 4
  • 70
  • 100
1
vote
1 answer

fusion::vector + fusion::push_back = fusion::vector?

I typedef a vector with two elements. Then I push_back into it an other element and expect what result type is also a vector. But that's not so. Example: typedef boost::fusion::vector vec1; typedef…
niXman
  • 1,698
  • 3
  • 16
  • 40
1
vote
1 answer

BOOST_FUSION_ADAPT_STRUCT using a recursive struct with a std::vector member

I am trying to declare a recursive AST for a spirit x3 parser. The parser grammar is working, and since it is recommended to avoid semantic actions I am trying to adapt the Rexpr official documentation example. In the main documentation, the parsed…
WaterFox
  • 850
  • 6
  • 18
1
vote
1 answer

How to initialize Boost.Fusion vector containing boost::array<> with initializer list

I need to initialize a boost::fusion::vector holding a boost::array as an element using initializer list. Is this possible? boost::array ary{true, false}; // works boost::fusion::vector vec1{ 5, false}; //…
anni
  • 338
  • 2
  • 12
1
vote
1 answer

Can/should i inherit from a Boost.Fusion sequence?

Can/should i inherit from a Fusion sequence to implement my own sequence class? If no, why not? For example: typedef boost::fusion::vector< std::vector, int, double > MyVector; class MyVectorWithData : public…
paperjam
  • 8,321
  • 12
  • 53
  • 79
1
vote
1 answer

making boost::fusion::result_of::as_set<> 's instance doesn't call its elements' constructors

#include #include #include #include #include #include #include #include…
DF24
  • 53
  • 4
1
vote
2 answers

Embedding a boost-spirit grammar parsing into a struct into another grammar gives compilation errors

I'm using boost spirit to parse some text. For this I have two grammars. The first one parses a string into a struct, the second one, takes a grammar as template argument and uses it to parse a sequence of data. The second parser should be flexible…
Xoozee
  • 370
  • 2
  • 9
1
vote
1 answer

BOOST_FUSION_ADAPT_ADT not finding setter method

I am trying to apply the BOOST_FUSION_ADAPT_ADT to class as shown below: class XY { private: std::string x; // lhs std::list> y; public: std::list> const &getY() const { return y; …
user2987773
  • 407
  • 5
  • 18
1
vote
1 answer

Alternative implementation for BOOST_FUSION_ADAPT_STRUCT

From link , the usage of BOOST_FUSION_ADAPT_STRUCT usage which is namespace demo { struct employee { std::string name; int age; }; } BOOST_FUSION_ADAPT_STRUCT( demo::employee, (std::string, name) (int,…
user2987773
  • 407
  • 5
  • 18
1
vote
1 answer

Compile-time Size of Struct Minus Padding

I'm trying to use Boost MPL and Fusion to calculate the size of a struct exclusive of any padding. This is my current best attempt: Live example template constexpr std::size_t sizeof_members(void) { using namespace std; namespace…
1
vote
1 answer

getting the structure name with boost fusion

Using boost::fusion is possible to iterate an adapted structure and get the name of each member of that structure. Is there a way to retrieve also the name of the structure some way? What I woulld like to do is the following: given the current…
Abruzzo Forte e Gentile
  • 14,423
  • 28
  • 99
  • 173