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

How do I instantiate and access boost mpl types?

So I've built my boost::mpl::map object which contains some mixture of keys and types. I now want to instantiate an instance of the map such that I have an instantiation of each type in the map: using namespace boost::mpl; using MyMap = map< …
quant
  • 21,507
  • 32
  • 115
  • 211
0
votes
1 answer

Difference between is_same and mpl::same_as in boost

I cannot seem to see the difference between boost::is_same and boost::mpl::same_as. Could someone perhaps point these out and where only the specific variant can be used.
abergmeier
  • 13,224
  • 13
  • 64
  • 120
0
votes
2 answers

boost::mpi throws MPI_ERR_TRUNCATE on multiple isend/irecv transfers with same tag

I'm seeing an MPI_ERR_TRUNCATE error with boost::mpi when performing multiple isend/irecv transfers with the same tag using serialized data. These are not concurrent transfers, i.e. no threading is involved. There is just more than one transfer…
rhashimoto
  • 15,650
  • 2
  • 52
  • 80
0
votes
2 answers

Variant for mpl types sequences as a class member - how?

Please advice, how I can solve the following problem – I want to have class member variable boost::variant type which has a type from defined mpl type sequence. After, in main, I want to call a method which calls method for every class method…
LowCoder
  • 71
  • 3
0
votes
2 answers

Boost MPL and_ type

I'm trying to use and_ in my code, and I'm having an issue with it's return type. I'm trying to use it with other metaprogramming constructs that accept and return true_type or false_type, and I use SFINAE overloads with those types also.…
Steve
  • 11,763
  • 15
  • 70
  • 103
0
votes
1 answer

Boost mpl::list variant serialization check_const_loading() compile error

The following uses mpl::list to initialize a boost variant. Then it serialize the variant. It compiles and work fine on save but not load. The compile even failed for load. Does anyone know what the issue is? thanks Attribute.h #include…
surfcode
  • 445
  • 1
  • 5
  • 20
0
votes
2 answers

boost-mpl, fold and placeholders, select class from vector

I am trying to learn C++ template metaprogramming. Given a boost::mpl::vector of classes I want to compute the index of that class where a static member variable has a certain value. I found a solution which seems to work. However, in order to…
jomulu
  • 1
  • 1
0
votes
2 answers

Compile error on boost::mpl::tag::type

I tried boost::mpl recently and it seems both awesome and horrible. Sometimes the compilation error information is rather confusing. This time I get problem on the following code: #include #include #include…
user957121
  • 2,946
  • 4
  • 24
  • 36
0
votes
1 answer

Using boost::mpl::iter_fold and also obtaining boost::mpl::vector of keys from boost::mpl::map

I am trying to write a small meta-program using boost.mpl that matches "named channels" between to audio formats using two channel maps. The Name is also an integer (enumeration). A simple example of what I am trying to achieve in a runtime might…
0
votes
0 answers

Getting started with boost mpl with vector and push_back

I've been scratching my head for far too long, I'm finding using MPL very difficult to get around and hoping somebody can get me started. Here is some partial code from a class I am developing which does not use MPL. I eventually want to implement…
woosah
  • 843
  • 11
  • 22
0
votes
2 answers

StackPointer template

I'm reading "Modern C++ design" and hit on an idea to build a class that would act like a pointer but it would allocate object on the stack instead of on the heap. It could be used in functions that would normally return a pointer to an object…
0
votes
1 answer

How to optimize boost::mpl::vector code?

Add the moment I play around with boost::mpl::* and try to extend the physical unit example. At the moment I have the following code: A simple physical base dimension represented by an mpl::vector: template < int Mass, int Length, int Time, int…
Maik
  • 541
  • 4
  • 15
0
votes
1 answer

How can we implement the Builder design pattern using boost::mpl?

I have three classes which adhere to the same concept class but differ on the underlying data structure used for storage. As an illustration take the three classes given below. template< typename T > class A{ std::vector storage; …
Samrat Roy
  • 105
  • 8
0
votes
2 answers

Different behavior of boost::mpl::or_ and boost::mpl::and_?

The code below tries to test the short circuit behavior of boost::mpl::or_ and boost::mpl::and_: #include #include #include #include #include #include…
Massimiliano
  • 7,842
  • 2
  • 47
  • 62
0
votes
1 answer

Compilation error with boost::mpl::if_

I'm trying to control the constness of some pointer type based on the constness of some template parameter type using boost::mpl. Here's my attempt: template struct iter { typedef typename boost::mpl::if_
Haitham Gad
  • 1,529
  • 2
  • 13
  • 23
1 2 3
19
20