boost-mpl Questions

3

Solved

I want to be able to pass an integer or a double (or a string) as a template argument and in some instances convert the result to an integer and use it as a template argument for a type in the clas...
Pyroelectric asked 8/8, 2014 at 2:20

5

Solved

I want to get the type name and print it for debug purposes. I use the following code: #include <cxxabi.h> inline const char* demangle(const char *s) { abi::__cxa_demangle(s, 0, 0, NU...
Boo asked 19/9, 2011 at 10:33

6

Solved

I want to do something like this: template<int N> char* foo() { // return a compile-time string containing N, equivalent to doing // ostringstream ostr; // ostr << N; // return os...
Burtie asked 15/7, 2011 at 21:37

8

Solved

Can you share any real-world examples of Boost::MPL usage (except lambdas), just to let me better understand its purposes and field of practical usage? The MPL documentation tutorial has a dimensio...
Fatuous asked 9/1, 2011 at 11:42

6

Solved

Generally, I would use boost::mpl::for_each<>() to traverse a boost::mpl::vector, but this requires a functor with a template function declared like the following: template<typename T>...
Unlimber asked 29/10, 2010 at 15:38

6

Consider the following header file: // Foo.h class Foo { public: template <typename T> void read(T& value); }; I want to explicitly instantiate the Foo::read member function templa...
Fowl asked 19/4, 2011 at 11:24

2

Solved

Assume that I have a nested boost::variant-type TNested containing some types and some other boost::variant types (that itself cannot contain again boost::variant types, so that there will be no re...

1

Solved

Say I have 2 tuples that are not instantiated. Is there an idiomatic way to check if one set is the subset of the other? If this requires another type instead of hana::tuple_c, this is fine as wel...
Hinge asked 7/1, 2016 at 10:12

1

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: templat...
Lucerne asked 14/12, 2015 at 9:24

1

I see two possible styles for implementing type lists in C++11/14 and I was curious if there's any reason to prefer one over the other. The first technique is outlined here and models itself on Boo...
Attract asked 12/6, 2015 at 18:4

2

I want to code a state machine which has a reaction list with more than 50 entries. I found here some python scripts to generate header files for lists with more than 50 entries. But I cannot man...
Punctuate asked 21/10, 2013 at 11:44

1

Solved

If I use boost::mpl, lets look at the following code: typedef fold< vector<long,float,long> , set0<> , insert<_1,_2> >::type s; BOOST_MPL_ASSERT_RELATION( size<s>::...
Pluto asked 18/2, 2015 at 14:6

2

Solved

I have a mpl::vector & want to instantiate a template using the vector elements as template arguments. How is this done? Can a argument pack be used to consolidate extra mpl::vector elements? ...
Wynd asked 29/1, 2015 at 4:54

1

Solved

I'm trying to provide a program a way to add new objects to a variant in a library but I'm encountering some cryptic errors. #include <boost/mpl/copy.hpp> #include <boost/mpl/joint_view.h...
Speculation asked 20/12, 2014 at 14:48

2

Solved

I have a templated class template<class U, class V, class W> class S { //... implementations }; and some stock type implementations for type U, V and W: typedef boost::mpl::vector<U0...
Rama asked 29/9, 2009 at 12:19

2

Solved

Taking the following example, I wonder whether there is an alternative to boost::mpl::for_each, which does call a Functor without any arguments. #include <boost/mpl/vector.hpp> #include <...
Hebdomad asked 25/7, 2014 at 10:59

3

Solved

Assume that I have the following class definition: template <unsigned int N> class foo { boost::tuples::tuple<...> bar; }; Given the compile-time constant N, I would like to expand ...
Abott asked 20/12, 2013 at 20:49

3

Solved

I have to different vectors mpl::vector<Type1, Type2...> mpl::vector<Type3, Type4...> I'd like to "concatenate" them to form: mpl::vector<Type1, Type2, Type3, Type4...> Thi...
Scaffolding asked 24/10, 2013 at 19:36

2

Solved

I have the following templated class structure struct TraitA{}; struct TraitB{}; template<typename trait> struct FunctionalityA{}; template<typename trait> struct FunctionalityB{}; ...
Limitative asked 6/5, 2011 at 8:47

1

Solved

In the following code (simplified for demonstration): namespace mpl = boost::mpl; using if1 = mpl::if_<std::is_same<double, mpl::_1>, double, void>; //using if2 = mpl::if_<std::i...
Parthia asked 5/11, 2013 at 19:17

1

Solved

I use boost::mpl::string<...> types extensively... enough that it would really help with debugging to have the types pretty-printed in gdb. So... instead of gdb showing the individual (multi...
Skerry asked 4/9, 2013 at 2:53

1

Let's say I have the following metafunction: template <typename T> struct make_pair { using type = std::pair< typename std::remove_reference<T>::type, typename std::remove_refere...

1

Solved

I have been trying to get to grips with Boost MPL. As simple exercises, I tried: typedef vector_c<int, 1, 2, 3, 4, 5>::type example_list; typedef transform<example_list, times<_, int...
Aegaeon asked 18/4, 2013 at 16:2

3

Solved

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 <tuple> #incl...
Witham asked 24/2, 2011 at 1:34

0

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 whic...
Dulciana asked 18/3, 2013 at 6:47

© 2022 - 2024 — McMap. All rights reserved.