Boost logo

Boost :

Subject: Re: [boost] About all these metaprogramming libraries
From: Peter Dimov (lists_at_[hidden])
Date: 2017-03-18 22:08:25


Vicente J. Botet Escriba wrote:

> * do we want (can) to use as (HOMF) high-order meta-functions? if we nedd
> them at all). IIUC, Peter library doesn't works with HOMFs.
> * do we want a Hana style with "concepts" and with customizations? Do we
> want other data type than type lists? IIUC Peter's library works only
> with template aliases as data types and almost variadic class template
> with type parameters is a good candidate for a type list (even
> std::variant :( )

These two are the distinguishing features of mp11. All other libraries have
chosen differently. To clarify, the mp11 approach does support higher-order
metaprogramming, but it chooses to make the ordinary case easier at the
expense of the HOMF case, which is made harder, whereas the other libraries
choose to make HOMF easier, at the expense of taking quoted metafunctions as
arguments, which requires aliases to be quoted.

mp11, in contrast, requires quoted metafunctions to be de-quoted (Q::invoke)
when passed to algorithms.

To clarify further, std::variant<T...> is absolutely a supported typelist in
mp11. If you have a std::variant V, you can remove the duplicate types from
it with mp_unique<V>. This is again a deliberate design decision which keeps
simple uses simple at the expense of making more complicated uses more
complicated. With the other libraries, to remove the duplicates from a
variant, you first have to convert it to the native typelist type, apply
'unique', then convert back to std::variant.


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