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
9
votes
4 answers

How to inherit from a list of types and then call a member on the list of inherited members?

I have a set of classes that have the following structure: class U { public: explicit U(int) { ... } U() {...} Init(int) {...} }; I need to be able to compose 1 or more of these classes into a class X. Pseudocode: template
Armen Tsirunyan
  • 130,161
  • 59
  • 324
  • 434
9
votes
2 answers

Creating all template permutations with MPL

I have the following templated class structure struct TraitA{}; struct TraitB{}; template struct FunctionalityA{}; template struct FunctionalityB{}; template struct FuncUserA{}; template
mkaes
  • 13,781
  • 10
  • 52
  • 72
9
votes
1 answer

How to define heterogenous std::map using boost::variant in "two dimensional manner"

I would be happy to get and advice how to deal with boost::variant in "two dimensional manner". Sounds strange but let my code say more (hopefully): I have coded a class called Parameter: template
Martin Kopecký
  • 912
  • 5
  • 16
9
votes
1 answer

How to loop through a boost::mpl::list?

This is as far as I've gotten, #include #include namespace mpl = boost::mpl; class RunAround {}; class HopUpAndDown {}; class Sleep {}; template int doThis(); template<> int…
Kyle
  • 4,487
  • 3
  • 29
  • 45
9
votes
2 answers

C++/Boost MPL: structure code likewise Haskell's let, where,

As C++ metaprogramming is functional: is there any way of doing something comparable to any functional programming language's (e.g. Haskell's) let or where construct? I'm using Boost::MPL but would like to have more structure for longer…
user1034081
  • 618
  • 5
  • 21
8
votes
3 answers

C++ forbid overwriting a virtual function

I use a class A from a library and want to add some functionality to it via an own class B. The user of class B should derive from it as if he would derive from class A. class A { public: virtual void func1()=0; virtual void…
Heinzi
  • 5,793
  • 4
  • 40
  • 69
8
votes
3 answers

How to use std::tuple types with boost::mpl algorithms?

The boost::mpl algorithms seem not to be able to work on std::tuple types out of the box, e.g., the following does not compile (boost-1.46.0, g++ snapshot 2011-02-19): #include #include #include…
Lars
  • 2,616
  • 3
  • 21
  • 18
8
votes
3 answers

How to "concatenate" boost::mpl::vectors

I have to different vectors mpl::vector mpl::vector I'd like to "concatenate" them to form: mpl::vector This would allow me to prepare vector templates and reuse them…
Kikosha
  • 343
  • 6
  • 16
8
votes
1 answer

Implications of using mpl::inherit_linearly for defining interfaces

I am writing some message handling code, whereby each message is a POD structure. On way of writing this would be to define an abstract base class, with virtual functiosn for each message type e.g: class AbstractHandler { public: virtual void…
mark
  • 7,381
  • 5
  • 36
  • 61