Boost logo

Boost :

Subject: Re: [boost] [review][mp11] Formal review of Mp11
From: Bruno Dutra (brunocodutra_at_[hidden])
Date: 2017-07-17 11:47:27


On Mon, Jul 17, 2017 at 1:06 AM, Peter Dimov via Boost <
boost_at_[hidden]> wrote:

> Joaquin M López Muñoz wrote:
>
>> Porting from / coexisting with Boost.MPL would be greatly aided by some
>> utility function to convert Boost.MPL sequences to Mp11 lists:
>>
>
> ...
>
> This unfortunately doesn't work in general - as Bruno Dutra explained to
> me - because MPL operations on, f.ex. mpl::vector, do not necessarily
> return an mpl::vector.

This reads backwards to me.

It's true that the signature (i.e. types) of Boost.MPL containers are left
unspecified and, indeed, on some platforms mpl::vector is implemented via
inheritance through opaque proxy types, but that only means one can't
simply rely on the property that any instance of a variadic template class
is a List to advertise seamless interoperation with Boost.MPL, which is
also aggravated by the fact it emulates variadic parameters packs via
default template arguments.

The alternative, which seems to be what Joaquin proposes here, is to
provide a utility metafunction that explicitly converts from Boost.MPL
containers into variadic Lists and one simple way of doing it is to use
mpl::fold to push the elements of Boost.MPL containers one by one into a
variadic List by means of a custom Metafunction Class in the Boost.MPL
sense.

Bruno


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