Questions tagged [boost-mp11]
16 questions
5
votes
0 answers
How to avoid unnecessary instantiations with Boost.MP11
I have been using my own TMP library for quite some time. However, I want to start using Boost.MP11. The interface is quite nice, and, to give myself some motivation to learn it, I did the 2022 Advent of Code as much as I could at compile time,…

Jody Hagins
- 27,943
- 6
- 58
- 87
3
votes
1 answer
How to instantiate template methods in a "cycle"?
I have a class with several template methods, i.e.:
class MessageEndpoint
{
public:
using SupportedMessages = boost::mp11::mp_list;
public:
virtual…

A.N.
- 278
- 2
- 13
3
votes
2 answers
Struggling with Boost.Mp11: "expected a class template, got 'T'"
I am trying to check the unspecialised uniqueness of a tuple of specialised types using Boost.Mp11:
#include
#include
#include
#include
#include
namespace
{
template

cmannett85
- 21,725
- 8
- 76
- 119
2
votes
1 answer
Using boost mp11 to switch on runtime value efficiently(breaking when processing function is done)
I have the following code where I implement dispatching on runtime value to interpret the data in certain way(in this toy example data can be either uint8_t or short).
Code seems to work, but I am wondering if I can somehow microoptimize the code so…

NoSenseEtAl
- 28,205
- 28
- 128
- 277
2
votes
1 answer
What is the purpose of "quoted metafunction" in boost mp11?
I am trying to learn basics of boost::mp11, docs are ok, but one thing I do not understand is the following:
what is the purpose of quoted metafunctions?
Docs say this:
A quoted metafunction is a class with a public metafunction member
called fn,…

NoSenseEtAl
- 28,205
- 28
- 128
- 277
2
votes
2 answers
Using automatically deduced lambda parameter as constant expression
In C++, I'm trying to write something similar to boost-mp11's mp_for_each. However, whilst mp_for_each always calls the supplied function for every T in the given mp_list, I'm trying to come up with a solution that stops traversal once a…

ngmr80
- 135
- 5
1
vote
3 answers
Transformation of compile time list of lists of types into a list of lists of indices
I would like to transform a compile time list of lists of types into a list of lists of std::integral_constant indices.
Appearently this requires some kind of 2d iota-like transformation.
Example source
template struct…

Chris G.
- 816
- 2
- 15
1
vote
1 answer
'value_from': no matching overloaded function found Project1
I am implementing a program,It can make a function call based on the given string.
The implementation is as follows:
it might be a bit long, here is the online version
#include
#include
#include
#include
#include…

Kargath
- 450
- 5
- 15
1
vote
0 answers
question about using mpl::range_c with mpl::fold
i have below simple function to convert a mpl::vector<...> to pack<...>
namespace mpl = boost::mpl;
template
struct pack{};
struct A{};
struct B{};
template
struct mp_append_impl;
template …

mubcarb
- 161
- 1
- 8
1
vote
2 answers
Apply stateful lambda to integer sequence values
I am playing around with trying to implement the numeric literal operator template.
#include
#include
#include
#include
#include
#include
using…

NoSenseEtAl
- 28,205
- 28
- 128
- 277
1
vote
1 answer
boost::mp11::mp_list can't define proper transition table for FSM based on boost::msm, what is missing?
Does boost::mp11::mp_list can be used instead of boost::mpl::vector as transition-list in state-machines constructed with boost::msm?
I just tried it (link) and it seems that:
it compiles
but it does not work - transitions tables are missing
and…

PiotrNycz
- 23,099
- 7
- 66
- 112
1
vote
1 answer
Boost mp11 mp_for_each with additional function argument
I'm trying to pass a list of pairs of types constructed from boost::mp11::mp_product to a function that takes the pairs along with an additional function argument via boost::mp11::mp_for_each.
The docs I've found for mp_for_each are limited to use…

ddavis
- 337
- 5
- 15
1
vote
1 answer
Unnest Boost Mp11 list
Using Boost Mp11, I can create a nested mp_list as
#include
#include
namespace mp11 = boost::mp11;
using num_types = mp11::mp_list;
template
using object_types =…

nbenn
- 591
- 4
- 12
1
vote
1 answer
Failing trying to define a Boost::mp11::find_if predicate
I've been writing some policy/trait-based designs, and I came across a problem with Boost::mp11 that I don't understand. I have reduced the problem to following example:
#include
#include
#include
#include…

cmannett85
- 21,725
- 8
- 76
- 119
0
votes
1 answer
Template metaprogramming - trying to implement Dimensional Analysis
For a better understanding and learning, I tried to use the boost mp11 library to implement the Dimensional Analysis from "C++ Template Metaprogramming" book (also found in the documentation of boost mpl library). A reason why was that C++11 has…

LiviuSandu
- 3
- 2