Questions tagged [boost-mpl]

The Boost.MPL library is a general-purpose, high-level C++ template metaprogramming framework of compile-time algorithms, sequences and metafunctions. It provides a conceptual foundation and an extensive set of powerful and coherent tools that make doing explicit metaprogramming in C++ as easy and enjoyable as possible within the current language.

The Boost.MPL library is a general-purpose, high-level C++ template metaprogramming framework of compile-time algorithms, sequences and metafunctions. It provides a conceptual foundation and an extensive set of powerful and coherent tools that make doing explicit metaprogramming in C++ as easy and enjoyable as possible within the current language.

289 questions
1
vote
1 answer

Extending types of a boost::variant dynamically

I have to write a library exporting data to various formats. Every format is a type of a given boost::variant, e.g. typdef boost::variant TFormat with formats csv, xml and hdf5. This approach worked quite good for me. The library…
Aleph0
  • 5,816
  • 4
  • 29
  • 80
1
vote
1 answer

boost::mpl::map of type and char string

Is something like following typedef boost::mpl::map< pair , pair , pair > m; possible? If not, what are the alternatives ?
Recker
  • 1,915
  • 25
  • 55
1
vote
1 answer

How to instantiate templates from mpl::vector?

How a can transform vector of stl containers? I have: typedef boost::mpl::vector, std::deque > Containers; Heed to transform it to: typedef boost::mpl::vector, std::deque >…
1
vote
0 answers

c++ compile-time for loop over integer constant

I was working on porting some Windows c++ code to linux, which involves template specialization and boost::mpl. My problem is that (1) cannot get the class template partial specialization compile (due to argument dependence), (2) or if template can…
1
vote
1 answer

How can I implement nested boost::mpl::fold

How can I implement nested boost::mpl::fold ? namespace mpl=boost::mpl; typedef mpl::vector_c vec1; typedef mpl::vector_c vec2; typedef mpl::vector_c vec3; typedef mpl::vector vvec; typedef typename…
user9247
  • 49
  • 4
1
vote
1 answer

How to apply an mpl::transform to an mpl::string?

I'm trying to apply a transformation to an mpl::string, but can't get it to compile. I'm using MS VC++2010 and Boost 1.43.0. The code: #include #include #include #include…
Pedro d'Aquino
  • 5,130
  • 6
  • 36
  • 46
1
vote
1 answer

Runtime find first match in boost::mpl::vector

I have a boost::mpl::vector and now would need a template (function), which "iterates" over the types until the first match (at runtime) is found. Something similar to boost::fusion::find_if, but without sequence being a runtime value. Would image…
abergmeier
  • 13,224
  • 13
  • 64
  • 120
1
vote
2 answers

Is it possible to have a branch of code conditionally be compiled in C++?

Title says it all really. Sample code which illustrates the spirit of the affaire: if( std::is_constructible::value ) { unsigned long identity = collection.rbegin()->first + 1; std::shared_ptr newObject(new…
MB.
  • 1,303
  • 12
  • 19
1
vote
1 answer

Retrieve iterator position from mpl fold expression

How can I obtain the index of the following folded type with boost::mpl (which is some kind of mpl::set but not quite). The value iter::pos::value is somehow not defined?? using unique_types = typename mpl::fold< …
Gabriel
  • 8,990
  • 6
  • 57
  • 101
1
vote
2 answers

Create function parameter pack from Iterator pair

I can't figure out how to invoke a function with a variable number of arguments retrieved from an iterator. I have a simple example using std::plus to illustrate the problem: #include #include…
KentH
  • 1,204
  • 1
  • 14
  • 23
1
vote
0 answers

accumulate items in mpl sequence

Is it possible to write a metafunction to accumulate items in an mpl sequence? By this, I mean something like: // ops.h using boost::mpl; using op_list = vector<>; using add_op = <<>>; ... // some_ops.h #include…
KentH
  • 1,204
  • 1
  • 14
  • 23
1
vote
1 answer

Generating C++ typename by concatenating template parameter with a string

I'm trying to figure out a way to use Boost::MPL to generate a typename which is the concatenation of a template parameter and a string. I have pairs of classes which are named: X and XProvider. The latter is a factory class which instantiates…
Shmuel Levine
  • 550
  • 5
  • 18
1
vote
0 answers

[boost]Why don't integral_c and int_ share a same type

I just wonder, that when both int_ and integral_c is generated from aux_/integral_wrapper.hpp, also gcc -E output a same class structure, which only differs in class name, why not simply make int_ a type alias to integral_c ? (such as template…
owensss
  • 121
  • 4
1
vote
1 answer

Boost Spirit kwd parser in Visual Studio 2013

I'm using Boost 1.57 with Visual Studio 2010. I would like to upgrade my project to Visual Studio 2013 but i'm having some problem with the boost Spirit parser. Seem to me that the kwd parser is broken somehow. The following code compiles correctly…
Gab
  • 756
  • 11
  • 23
1
vote
1 answer

How is boost::mpl::map (or set) implemented?

I would like to know how to implement a template metaprogramming structure like boost::mpl::map, that is a structure that supports constant-time insertion and removal of elements, and testing for membership. It is hard to find real implementation in…
Paweł Bylica
  • 3,780
  • 1
  • 31
  • 44