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

How do I join two or more boost fusion maps?

I want to create an associative sequence from two boost::fusion::map types. The types contained in the one of the maps might exist in another, and if this is the case I want to only end up with a single type with that key in the resulting sequence.…
quant
  • 21,507
  • 32
  • 115
  • 211
3
votes
0 answers

Boost fusion serialization of a class using BOOST_FUSION_ADAPT_ADT

I am trying to get a serialization module for classes using boost fusion. I have converted my class to a boost::fusion sequence. This example is followed from the slides of the talk of Michael Caisse at boostcon 13…
balas bellobas
  • 237
  • 3
  • 12
3
votes
1 answer

Why doesn't boost::fusion::as_set remove duplicates from a boost::fusion::vector?

I have: auto my_vec2 = boost::fusion::make_vector(42,false,42); auto my_set2 = boost::fusion::as_set(my_vec2); and when I go to debug I was expecting my_set2 to only contain 42 and false, however it contained 42 twice. Why is this? If its a set…
user997112
  • 29,025
  • 43
  • 182
  • 361
3
votes
2 answers

What is the purpose of boost::fusion?

Ive spent the day reading notes and watching a video on boost::fusion and I really don't get some aspects to it. Take for example, the boost::fusion::has_key function. What is the purpose of having this in boost::fusion? Is the idea that we just…
user997112
  • 29,025
  • 43
  • 182
  • 361
3
votes
1 answer

How can I use boost::mpl::fold with a boost::fusion::map?

When I try to compile this: #include #include int main(int argc, char** argv) { typedef boost::fusion::map < boost::fusion::pair, …
chila
  • 2,372
  • 1
  • 16
  • 33
3
votes
2 answers

Implement an object directory: boost::any, boost::variant, or?

I'd like to implement a directory object which stores different types of object. Need to be able access the objects by name, get the actual pointer type and serialize it. The object I have in mind looks like this: struct Object { std::string…
surfcode
  • 445
  • 1
  • 5
  • 20
3
votes
2 answers

Adapting an empty struct for Boost Fusion

I have an empty struct: struct MyStruct {}; I want to adapt this to be used by Boost Fusion. Ordinarily I would use BOOST_FUSION_ADAPT_STRUCT, but this macro requires two parameters to name the struct and list its fields. Is there anyway to tell…
chrisaycock
  • 36,470
  • 14
  • 88
  • 125
3
votes
1 answer

tuple - get_or helper function

I need a tuple helper function that if a requested type does not exist in the tuple it returns a default constructed null type. e.g. std::tuple tuple(true, 0); static_assert(std::is_same(tuple)), …
ronag
  • 49,529
  • 25
  • 126
  • 221
3
votes
2 answers

Is it possible to use boost fusion map in reverse, aka key is 567, value is type ?

I would like to have value to type map, and from what I see boost fusion uses map that uses pair where type is always the first memeber(so it is key in a map)? map_type m( fusion::make_pair('X') , fusion::make_pair("Men")); Is…
NoSenseEtAl
  • 28,205
  • 28
  • 128
  • 277
3
votes
1 answer

Boost::fusion, Eigen and zip transformation

This question is a spin-off of another question I had concerning boost::fusion. The idea is to use boost::fusion to iterate over a large C-style struct containing N-dimension arrays. Computation on these arrays is done by Eigen. By using…
BenC
  • 8,729
  • 3
  • 49
  • 68
3
votes
1 answer

How to bind/call boost::function stored in fusion::vector from spirit semantic rule?

I am trying to map some keyword handlers (methods) via qi::symbols with values of boost::function type. So If keyword is found I want to call method. But I couldn't bind method from this map. Compiler failed with bunch of errors on phoenix::bind.…
3
votes
1 answer

Evaluating result of boost::phoenix::insert

I'm having difficulties trying to evaluate the result of boost::phoenix::insert which inserts elements into a map. Similar to the regular std::map::insert the actor object returned by boost::phoenix::insert also returns a std::pair
Stacker
  • 1,080
  • 14
  • 20
3
votes
2 answers

How to generalize a spirit parser to take lists in arbitrary order?

I have a simple parser which can parse lists of ints or quoted strings. If I do the SIMPLE_CASE where I take the input to be: std::string input1 = "{ INT: 42, 24 STR: \"Smith\", \"John\" }"; it parses correctly into my_record, which contains a list…
kfmfe04
  • 14,936
  • 14
  • 74
  • 140
3
votes
0 answers

boost fusion vector of different std::vectors to implement data frame

I'm trying to implement a "data frame" type class in C++ (like in S+/R), something along the lines of: template class data_frame; My goal here is to have the data stored in memory as "column vectors" (rather…
David H
  • 1,461
  • 2
  • 17
  • 37
3
votes
1 answer

Using a boost::fusion::map in boost::spirit::karma

I am using boost spirit to parse some text files into a data structure and now I am beginning to generate text from this data structure (using spirit karma). One attempt at a data structure is a boost::fusion::map (as suggested in an answer to this…
engineerX
  • 2,914
  • 2
  • 18
  • 18