Boost logo

Boost :

Subject: Re: [boost] New dependency report
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2014-06-07 11:37:29


Le 07/06/14 17:13, Ion Gaztañaga a écrit :
> El 06/06/2014 23:40, Peter Dimov escribió:
>> John Maddock wrote:
>>> I'm tied of saying this.... but if mpl::bool_ and int_ were moved out
>>> of MPL full, either to core, or to some mpl_core, then there's no need
>>> to split type_traits anymore.
>>
>> The question is: what is the minimal conforming implementation of a type
>> trait? Is it
>>
>> template<class T> struct something
>> {
>> bool const value = false;
>> }
>>
>> or is it, instead,
>>
>> template<class T> struct something: mpl::false_
>> {
>> };
>
> I would say the first one. I use my own true_/false_ wrappers in my
> libraries just to avoid MPL dependencies.
>
> To be standard conforming, we would need to add
> "std::integral_constant<bool, false>" as "type" member. But IMHO this
> seems a bit redundant.
>
Well, currently something more

       template <class T, T v>
        struct integral_constant {

          static constexpr T value = v;
          typedef T value_type;
          typedef integral_constant<T,v> type;
          constexpr operator value_type() const { return value; }
          constexpr value_type operator()() const { return value; }

        };

Vicente C++ International Standard


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