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…
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