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

C++ template metafunction on instantiated object of a template class

I hope that this question isn't overly convoluted. I realize that meta-programming acts on types rather than on the objects of those types; however, I am still trying to achieve the same result, by 1) retrieving the type information from the class…
Shmuel Levine
  • 550
  • 5
  • 18
1
vote
1 answer

How am I supposed to write a metafunction that works like the ones in MPL?

I seem to be missing something when trying to write a meta-function that calls into MPL code. The follow code fails to compile with the following error on inst2, but works fine on inst1: error C2903: 'apply' : symbol is neither a class template nor…
Mike
  • 693
  • 3
  • 13
1
vote
2 answers

boost mpl sequence pattern matching

I am trying to write a metafunction which (in haskell) looks roughly like: gather :: [a] -> [a] -> ([a], [a]) gather (x:xs) (_:_:ys) = ...other pattern matches... I was able to do this using a roll-my-own own…
nickdmax
  • 539
  • 2
  • 4
  • 11
1
vote
1 answer

using boost::mpl::bitor_

I have a class that accepts a list of policy classes using boost::mpl. Each policy class contains an identifying tag. I would like MyClass to produce the OR-ed result of each policy class' identifying tag. Unfortunately, I'm having some trouble…
PaulH
  • 7,759
  • 8
  • 66
  • 143
1
vote
1 answer

Boost fusion/mpl issues after upgrade to a newer version

This is a simplified version of some code I wrote: #include #include #include #include #include #include…
sinad
  • 137
  • 10
1
vote
0 answers

Deserialize Protocol Buffers using boost::mpl

I create my RPC Protocol with PB like: enum EMessages { E_MSG_METHOD_CONNECT = 0x8001, E_MSG_EVENT_CONNECT = 0xA001, ... } struct MsgHeader { required int32 sessionRef = 1; required int32 transactionId = 2; required int32 status …
Barzo
  • 1,039
  • 1
  • 11
  • 37
1
vote
1 answer

Use mpl::vector as function table

I am writing some C++ that reads an XML string and populates some struct members with values matching attribute keys in the XML file. At the moment, the first pass at this makes a stl::unordered_map of key - value pairs. The next step is to…
Matthew Smith
  • 6,165
  • 6
  • 34
  • 35
1
vote
1 answer

Does Boost::Mpi support parallel IO

Does Boost::Mpi support Parallel I/O? I cannot find any information about it and of course the boost documentation (even about the linker flags) is completly out of date ...
Wojciech Danilo
  • 11,573
  • 17
  • 66
  • 132
1
vote
1 answer

How to instantiate a boost::fusion::vector member variable of a type which has no default constructor?

I am learning boost::mpl and I have the following class - #include #include #include #include #include #include…
vsky
  • 389
  • 1
  • 5
  • 14
1
vote
4 answers

What's the idiomatic way to traverse a boost::mpl::list?

Edit: I've edited the sample to better resemble the problem I have, now the function depends on a regular parameter (and not only on template parameters) which means that the computations can't be made at compile time. I wrote some code with a…
Motti
  • 110,860
  • 49
  • 189
  • 262
1
vote
0 answers

Possible for templates to calculate largest order of magnitude for N-dimensional grid storage and operations?

Disclaimer: this is for hobby development - I wouldn't over-engineer this much in a professional endeavor unless asked to do so. Imagine an N-dimensional surface, such as a line (1D), grid/circle (2D), cube/sphere (3D), etc., where each axis of this…
jorgander
  • 540
  • 1
  • 4
  • 12
1
vote
1 answer

using mpl::fold with a placeholder and my own struct mishap

I have the following primary template: template struct Sol; and I specialize it for some pos values like so: template struct Sol<0, lev> { static const mpl::vector_c jumps; static const…
Palace Chan
  • 8,845
  • 11
  • 41
  • 93
1
vote
0 answers

Macros for generation boost::mpl::vector sequence

After long time searching how to generate function with variadic argument i found some solution. #define item(z, n, _) \ BOOST_PP_EXPR_IF(n, +) BOOST_PP_CAT(p, n) \ #define add(z, n, _) \ template inline T add(…
Topilski Alexandr
  • 669
  • 1
  • 12
  • 34
1
vote
1 answer

c++ array of heterogeneous types

I need to build an array of heterogeneous types in c++. The array is constructed at compile time, however, its construction is dispersed across different compilation unit (i.e. different source files). The array should be easily extended to contain…
Ezra
  • 1,401
  • 5
  • 15
  • 33
1
vote
0 answers

How to generate wrappings for C++ functions?

I'm trying to create a generic way to wrap C++ functions (from a different language). I have a list of parameters (and and an iterator) and a specific C++ function to be called on the list of parameters. I'm trying to find someway to unpack the list…
Abe Schneider
  • 977
  • 1
  • 11
  • 23