|
Boost : |
Subject: Re: [boost] About all these metaprogramming libraries
From: Bruno Dutra (brunocodutra_at_[hidden])
Date: 2017-03-19 20:50:18
On Sun, Mar 19, 2017 at 9:29 PM, Peter Dimov via Boost <
boost_at_[hidden]> wrote:
> Bruno Dutra wrote:
>
>> > It would be possible in principle to make the algorithms take >
>> mpl::vector and return mp_list, I suppose.
>>
>> You forgot to take into account that algorithms such as mpl::insert and
>> mpl::erase return proxies that inherit from vectors and don't expose the
>> elements in their types signatures, while being themselves valid instances
>> of a Vector. This is the real deal breaker.
>>
>
> On MSVC, insert/erase return numbered vectors, but on g++ and clang++,
> you're right, they return some weird v_item sequences.
>
> What is our use case here though? From where would those mpl types come?
>
I don't have a use case, I'm just trying to argue against the idea of
implementing any implicit native support for MPL sequences, which besides
non-trivial is also fruitless.
Moreover, providing support for numbered instances of mpl::vector only and
not for its proxies would really be a bad idea, because it doesn't solve
the common use case, where the user has some legacy metaprogram that
manipulates mpl::vectors, certainly also through insert and erase, and
wants to pass this on to the algorithms of a new library that advertises
itself as interoperating with MPL natively, only to realize the hard way
that it doesn't really.
I stand by the opinion that it can't go wrong with explicit converters.
Bruno
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk