Boost logo

Boost :

Subject: Re: [boost] Formal Review Request: mp11
From: Peter Dimov (lists_at_[hidden])
Date: 2017-03-18 13:50:47

Bjorn Reese wrote:

> Apropos mp_transform, would it be possible to extend it such that we can
> pass a type-trait directly to it? For example:
> using const_list = mp_transform<std::add_const, typelist>;
> instead of using std::add_const_t. The reason I ask is that I have lots of
> my own domain-specific type-traits that does not come with a _t version,
> so this is mainly for convenience.

That's unfortunately not possible because mp_transform<std::add_const,
mp_list<int, float>> is perfectly valid and yields mp_list<add_const<int>,
add_const<float>>. I can add

template<template<class...> class T> struct mp_quote_trait
    template<class... U> using invoke = typename T<U...>::type;

that would allow

    mp_transform<mp_quote_trait<std::add_const>::invoke, L>

but that's not much of an improvement. _t is the way to go with mp11.

> The reference documentation is a bit terse and obscure.

That it is. I'm gradually improving it bit by bit when I find time to work
on it.

Boost list run by bdawes at, gregod at, cpdaniel at, john at