|
Boost : |
Subject: Re: [boost] [review][mp11] Formal review of Mp11
From: Joaquin M López Muñoz (joaquinlopezmunoz_at_[hidden])
Date: 2017-07-18 07:58:19
El 17/07/2017 a las 23:03, Peter Dimov via Boost escribió:
> Joaquin M López Muñoz wrote:
>> Something more generic can be provided
>>
>> [...]
>>
>> template<typename MplSequence>
>> using mp_mpl_sequence=typename
>> mp_mpl_sequence_impl<MplSequence>::type;
>
> How about we provide it in MPL instead?
>
> namespace mpl {
>
> template<class Seq, template<class...> class L = std::tuple> using
> to_tuple = /*as above*/
>
> }
>
> to_tuple subject to bikeshedding (to_variadic? as_variadic_sequence?).
Well, I guess users don't care where the utility belongs as long as it's
documented and available
somewhere. If you want to integrate with MPL nicely, this probably
should take the form of a
variadic sequence inserter
(http://www.boost.org/libs/mpl/doc/refmanual/inserter.html ).
Something like:
struct variadic_inserter_op
{
template<template<typename...> class L,typename... Ts,typename T>
static L<Ts...,T> helper(L<Ts...>,T);
template<typename L,typename T>
struct apply
{
using type=decltype(helper(std::declval<L>(),std::declval<T>()));
};
};
template<template <typename...> class L>
struct
variadic_inserter:boost::mpl::inserter<L<>,variadic_inserter_op>{};
template<class Seq,template<typename...> class L=std::tuple>
using to_variadic_sequence=boost::mpl::copy<Seq,variadic_inserter<L>>;
Note that this would be the only C++11 piece of code in Boost.MPL.
JoaquÃn M López Muñoz
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk