Boost logo

Boost :

Subject: Re: [boost] About all these metaprogramming libraries
From: Peter Dimov (lists_at_[hidden])
Date: 2017-03-18 23:29:35


Vicente J. Botet Escriba wrote:

> I have the impression that mp11 cannot use the meta function returned by a
> function as a parameter of an algorithm, but I'm missing something that it
> should be evident to you. How can we define a compose meta-function that
> could be used later as parameter?

This is a metafunction in mp11:

template<class... T> using F = /*...*/;

This is a quoted metafunction:

struct Q
{
    template<class... T> using invoke = /*...*/
};

Since quoted metafunctions are types, you can operate on them (although mp11
doesn't yet provide any built-in means to compose them), but to pass one to
an algorithm, you need

    mp_transform<List, Q::invoke>

instead of just

    mp_transform<List, F>

> I just find it weird to take std::variant as a data type that models type
> list.

The need to operate on the list of variant alternatives is actually pretty
common. Hence std::variant_size (which is just mp_size in mp11),
std::variant_alternative_t (mp_at_c). Similarly std::tuple_size,
std::tuple_element_t. This endless reinvention of the wheel is completely
unnecessary.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk