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

Does std::variant provide functionality similar to boost::variant<>::types?

boost::variant exposes its list of variant types via boost::variant<>::types, which can be conveniently used with boost::mpl::for_each. std::variant is missing such a member. I see std::variant_alternative is provided. Can this be used to produce a…
Braden
  • 1,448
  • 10
  • 11
0
votes
1 answer

Boost 1.61 header is trying to redefine mpl_::bool_

I'm on Boost 1.61 and compiling with clang 4.0.1 and I'm compiling for linux-gnu Previously I was on Boost 1.52 and was not having this issue. Just by changing versions, I'm getting a compiler error about redefining mpl_::bool_ I'm not using any…
user99999991
  • 1,351
  • 3
  • 19
  • 43
0
votes
1 answer

Replacing Boost MPL containers with C++17 features

I have some old code based on MPL containers, using enable_if to to activate some dispatch like this: typedef boost::mpl::vector, std::complex > Types; template…
Matthieu Brucher
  • 21,634
  • 7
  • 38
  • 62
0
votes
2 answers

C++ map key to object

Hi is there a container where a key is a typename and value is an object/instance in boost or std??? What I want to achieve is I have a object pool for each data type and when I want to construct that object I want to just fetch by Key. I already…
Martin Kosicky
  • 471
  • 4
  • 12
0
votes
1 answer

MPL Map Instantiate Type

I have the following: class Message { public: bool process() { return doProcess(); } protected: virtual bool doProcess() = 0; }; class Hello : public Message { protected: bool doProcess() { return false; …
joshu
  • 463
  • 8
  • 18
0
votes
1 answer

boost MPL - doing transform on joint_view

Consider: template struct MakeVectorOfType { typedef std::vector type; }; typedef boost::mpl::vector TScalarTypes; typedef boost::mpl::transform>::type…
Roel
  • 19,338
  • 6
  • 61
  • 90
0
votes
1 answer

I need the boost::mpl implementation of exp() function

Does anybody know where can I find it? Otherwise I'll have to write it by myself. Thanks.
niXman
  • 1,698
  • 3
  • 16
  • 40
0
votes
1 answer

How process knows when to stop listening for receive?

Consider a mesh whose bins are decomposed among processes. The numbers in the image are the ranks of processes. At each time step, some of the points displace so that it is needed to send them to new destinations. This point-sending is done by all…
Shibli
  • 5,879
  • 13
  • 62
  • 126
0
votes
2 answers

Storing attributes in a STL container?

Suppose I have a class called generic_pair of the form: template < typename K, typename V > struct generic_pair{ K key; V value; }; Now, the problem is I would like to be able to store a bunch of these generic_pairs in an STL container BUT not…
kvs
  • 95
  • 1
  • 7
0
votes
1 answer

Utilize boost-variant to create generic factory method with boost::mpl::for_each

In one of my projects I needed to map the int of the boost::variant which()-Function to the types of the boost::variant. For some reasons the map doesn't contain the correct TVar Type? Why is that? #include #include…
Aleph0
  • 5,816
  • 4
  • 29
  • 80
0
votes
1 answer

Getting the index of boost::fusion::vector from a boost::mpl::vector

I started to play around with the boost fusion and mpl library and got stuck with a quite simple problem. I declared the following types: typedef boost::mpl::vector TypeVector; typedef boost::fusion::vector
mkaes
  • 13,781
  • 10
  • 52
  • 72
0
votes
2 answers

how to get type of variable?

example: template struct type_of { typedef boost::mpl::if_, typename boost::remove_pointer::type, T >::type type; }; int main() { int* ip; type_of::type iv = 3; // error: 'ip' cannot appear…
niXman
  • 1,698
  • 3
  • 16
  • 40
0
votes
0 answers

Group several MPL assertions in a macro

I'm trying to do something like that: #define VERIFY_EXPECTATIONS \ BOOST_MPL_ASSERT((expectation1)); \ BOOST_MPL_ASSERT((expectation2)); \ BOOST_MPL_ASSERT((expectation3)) and when writing VERIFY_EXPECTATIONS; in line, say 42, I get an error…
0
votes
2 answers

How to create an element for each type in a typelist and add it to a vector in C++?

In C++, I 'd like to create a new element (shared_ptr) for each type specified in a typelist (and add the resulting pointers to a vector). In pseudo code, this should look similar to this: vector< shared_ptr< baseT > > v; foreach(type T:
0
votes
2 answers

Defining tags and sequences with Boost.MPL in one shot

I have a problem with Boost.MPL and I'm not sure how to approach it. Currently my code looks like this: struct Definition { typedef boost::mpl::int_<5> A; typedef boost::mpl::int_<3> B; typedef boost::mpl::int_<6> C; typedef…
Adam Romanek
  • 1,809
  • 1
  • 19
  • 36