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

BOOST_FUSION_ADAPT_TPL_STRUCT and template array size

I am trying to iterate over a C++ template structure thanks to BOOST_FUSION_ADAPT_TPL_STRUCT. My structure contains fixed-size multidimensional arrays whose sizes are template parameters. If we consider Boost's example modified to fit my…
BenC
  • 8,729
  • 3
  • 49
  • 68
4
votes
2 answers

Casting boost::fusion::vector

Numbered form of boost::fusion::vector looks like template class vector1; template class vector2; etc. And variadic form looks like template class…
andigor
  • 722
  • 6
  • 17
4
votes
2 answers

How to identify types in boost fusion vector

How would one go about identifying the types inside a boost::fusion vector? e.g. fusion::vector v; then something that would let me identify v[0] as being type int, v[1] as type double and v[2] as type string. Thanks.
arlogb
  • 681
  • 1
  • 9
  • 19
3
votes
1 answer

Passing/binding arguments when using boost::fusion::for_each

I would like to call a function on all elements of a boost::fusion::vector. The elements are of types like this: class A { ... void print_with_prefix(const char *prefix) { std::cout << prefix << *this; } }; One can call this…
hrr
  • 1,807
  • 2
  • 21
  • 35
3
votes
1 answer

boost::fusion::result_of::as_set (or as_vector) converted from complex (nested) mpl sequences

#include #include #include #include #include #include #include…
3
votes
1 answer

Boost Fusion/MPL: convert type from sequence to sequence of equivalent any_range's

I want to use Boost's any_range to handle multiple heterogeneous data ranges. The type of my data ranges is known as a Fusion vector, for example: typedef vector TypeSequence Given such a type, I want to write a template to…
paperjam
  • 8,321
  • 12
  • 53
  • 79
3
votes
1 answer

Can spirit X3 work with BOOST_FUSION_ADAPT_ADT?

Change my codes from QI to X3, and get some compile error with BOOST_FUSION_ADAPT_ADT. I tried boost 1.64 and 1.67, neither of them work. I modified the spirit X3 example rexpr_min, adding getter and setter to struct rexpr, changing the…
He Ming
  • 88
  • 6
3
votes
1 answer

Define Hana struct with template parameters

Is there a way to define(adapt) a struct for Hana that has template parameters? The canonical example is a non-template class, #include #include namespace hana = boost::hana; struct Person { …
alfC
  • 14,261
  • 4
  • 67
  • 118
3
votes
1 answer

Passing a vector or arguments to boost::process (boost::fusion)

I'm trying to create a boost::process from a vector of string arguments: void runProcess( const std::string& exe, const std::vector& args ) { bp::ipstream out; bp::child c(exe, args, std_out > out); ... } This apparently…
jpo38
  • 20,821
  • 10
  • 70
  • 151
3
votes
1 answer

How do I get iterator into boost fusion map?

I'm trying to get iterator for boost::fusion::map, but I'm missing something. The following works with boost::fusion::vector: typedef vector vector_t; vector_t vec(20,'B',14.5); typedef result_of::begin::type vb; typedef…
stefanB
  • 77,323
  • 27
  • 116
  • 141
3
votes
1 answer

how to access elements of a tuple in a semantic action

My grammar has various entries which start with a generic name. After I determined the type I would like to use the expectation operator in order to create parsing errors. rule1=name >> (type1 > something); rule2=name >> (type2 > something); I…
user6520006
3
votes
3 answers

What's the deal with BOOST_FUSION_ADAPT_STRUCT with more than 64 members?

Trying to create boilerplate code for a huge struct with more than 64 members and the BOOST_FUSION_ADAPT_STRUCT macro but it fails to compile in VS2015 Update 3. I've tried to play with BOOST_FUSION_HAS_VARIADIC_VECTOR and BOOST_PP_LIMIT_TUPLE but…
kreuzerkrieg
  • 3,009
  • 3
  • 28
  • 59
3
votes
2 answers

boost::fusion::map allows duplicate keys

According to the boost::fusion::map docs: A map may contain at most one element for each key. In practice, it is easy to violate this. I am able to define the following type: using map_type = fusion::map< fusion::pair ,…
Steve Lorimer
  • 27,059
  • 17
  • 118
  • 213
3
votes
1 answer

Can I read a file and construct hetereogenous objects at compile time?

Situation: YAML file containing list of heterogeneous objects by name, like so: object: Foo name: Joe Bloggs age: 26 object: Bar location: UK Objects do not inherit from any base class or share any sort of relationship between each other…
Sam Kellett
  • 1,277
  • 12
  • 33
3
votes
3 answers

How do I extend the fusion container size limits beyond 50?

I want to generate boost fusion type sequences with more than 50 elements. The contents of boost/fusion/container/vector/vector50.hpp seems to suggest that a macro BOOST_FUSION_DONT_USE_PREPROCESSED_FILES might be used to affect this limit…
quant
  • 21,507
  • 32
  • 115
  • 211