Boost logo

Boost :

Subject: Re: [boost] [TTI] Review for The Type Traits Introspection library by Edward Diener **extended**
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2011-07-17 02:21:53


On Sat, Jul 16, 2011 at 11:02 PM, Joel falcou <joel.falcou_at_[hidden]> wrote:

> On 17/07/11 04:58, Jeffrey Lee Hellrung, Jr. wrote:
>
>> * I *think* all generated metafunctions should also expose a nested "type"
>> typedef in addition to a nested "value" static bool in order to be fully
>> Boost.MPL compatible, but...I'm not sure on this one. For some reason,
>> I've
>> always followed this practice, I think because it allows has_type_xxx<T>
>> to
>> be used as a nullary Boost.MPL metafunction. Can someone comment on this?
>>
>
> Yes, could be nice to have as it will make the metafunction proper nullary
> MPL one. I suggest findign a way to inherit from boost::mpl::bool_ whenever
> possible.
>

I think inheritance might be inconvenient in this case, as I'm guessing (I
haven't yet looked at the implementation) the value member is computed as

value = sizeof( ... ) == sizeof( ... );

Probably sufficient to

BOOST_STATIC_CONSTANT( bool, value = ... );
typedef this_metafunction_name type; // 1
typedef boost::integral_constant< bool, value > type; // 2
typedef boost::mpl::bool_< value > type; // 3

where I think any of 1, 2, or 3 is fine.

- Jeff


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