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

Adapt class containing a string member as synthesized attribute

I’m trying to parse a character string into an attribute of a custom type symbol, which contains a std::string member. I thought I could use BOOST_FUSION_ADAPT_STRUCT here but that doesn’t work. If I declare the rule as rule
Konrad Rudolph
  • 530,221
  • 131
  • 937
  • 1,214
7
votes
1 answer

Boost.MPL and type list generation

Background This is for a memory manager in a game engine. I have a freelist implemented, and would like to have a compile-time list if these. (A MPL or Fusion vector, for example). The freelist's correspond to allocation sizes, and when…
GManNickG
  • 494,350
  • 52
  • 494
  • 543
6
votes
1 answer

How can I make std::find_if and std::map work together using some boost library?

This question is inspired from another topic which poses this question: Find the first value greater than user specified value from a map container which can be solved in several ways. A typical C++03 solution defines a dedicated function (or…
Nawaz
  • 353,942
  • 115
  • 666
  • 851
6
votes
1 answer

Is it possible to fusion adapt the base class?

Is it possible to fusion-adapt the base class as if it where a member? First this is the documentation example, side-by-side with the new case: #include #include…
alfC
  • 14,261
  • 4
  • 67
  • 118
6
votes
2 answers

Is it possible to generate a fusion map from an adapted struct?

Let A be: struct A { int a; std::string b; struct keys { struct a; struct b; }; }; I would like to generate a fusion::map from the struct such that it contains the fusion::pairs: fusion::pair and…
gnzlbg
  • 7,135
  • 5
  • 53
  • 106
6
votes
3 answers

How to fill boost::fusion::vector at runtime?

Firstly, apologies for the similarity to my previous question here, but I don't think I asked the right thing. I have a method: template void some_method( T &t) {...} which takes a type fusion::vector to be…
arlogb
  • 681
  • 1
  • 9
  • 19
5
votes
2 answers

Generating Spirit parser expressions from a variadic list of alternative parser expressions

I'm looking for the simplest way to implement variadic function which takes list of boost::spirit::qi rules and expands the list into expression of format: rule1 | rule2 | rule3 |.... Let's assume that the rules synthesize no attribute. Your kind…
5
votes
1 answer

Does D std lib include something like boost.fusion and boost.mpl?

I'm still evaluating if i should start using D for prototyping numerical code in physics. One thing that stops me is I like boost, specifically fusion and mpl. D is amazing for template meta-programming and i would think it can do mpl and fusion…
kirill_igum
  • 3,953
  • 5
  • 47
  • 73
5
votes
1 answer

How to use BOOST_FUSION_ADAPT_STRUCT with substructures?

For instance, suppose I have the following struct/sub-struct definition: struct address_rec { std::string m_street; std::string m_state; unsigned m_zip; }; struct employee_rec { std::string m_name; address_rec m_address; }; How…
kfmfe04
  • 14,936
  • 14
  • 74
  • 140
5
votes
1 answer

Wrapping a Boost.Fusion Sequence

I'm looking for a way to create a Boost.Fusion sequence wrapper that is itself a Fusion sequence and forwards all 'calls' to its wrapped sequence. Something in the lines of template< typename Sequence > struct sequence_wrapper { explicit…
K-ballo
  • 80,396
  • 20
  • 159
  • 169
4
votes
1 answer

How to figure out the return type of a vector of nviews

I have the following problem: template /*what is the return type*/ nviewgetter( T const& t ) { typename T::const_iterator it(t.begin()); typedef BOOST_TYPEOF_TPL(*it) etype; typedef typename…
user677656
4
votes
1 answer

Function object in boost::fusion::for_each different from std::for_each

While upgrading to a newer compiler and resolving compiler errors I realized that boost::fusion::for_each requires that the function object passed in has the operator const. Example from Boost: struct increment { template void…
murrekatt
  • 5,961
  • 5
  • 39
  • 63
4
votes
2 answers

mpl::transform on boost::fusion::tuple

The following code does not compile on g++ (GCC) 4.6.0 20110603 (prerelease) with -std=c++0x and Boost 1.46.1. Am I missing an include or is this actually a bug? If the latter, how to work around it? #include #include…
pmr
  • 58,701
  • 10
  • 113
  • 156
4
votes
1 answer

Can I use BOOST_FUSION_ADAPT_STRUCT with inherited stuff?

Assume I have struct cat { int tail; int head; }; struct bird { int wing; int bursa; }; If I do this... struct wat : public cat, public bird { }; BOOST_FUSION_ADAPT_STRUCT(cat,tail,head) BOOST_FUSION_ADAPT_STRUCT(bird, wing,…
Carbon
  • 3,828
  • 3
  • 24
  • 51
4
votes
1 answer

Boost Spirit x3: parse into structs

From the Boost Spirit X3 tutorial: First, let's create a struct representing an employee: namespace client { namespace ast { struct employee { int age; std::string surname; std::string forename; double salary; …
Filippo
  • 361
  • 1
  • 5
  • 16
1
2
3
14 15