Boost logo

Boost :

Subject: Re: [boost] [Review] Boost.Type Traits Extension by Frederic Bron
From: Vicente Botet (vicente.botet_at_[hidden])
Date: 2011-03-15 05:28:28


Frédéric Bron wrote:
>
>> are you saying that you can check if the return type is actually void? I
>> believed that this was not possible, but who knows ...
>
> If you look at the implementation, I must separate implementation for
> operators returning void and operators returning non-void.
> So I know if the operator returns void or not:
>
> // this intermediate trait has member value of type bool:
> // - value==true -> operator- returns void
> // - value==false -> operator- does not return void
> template < typename RHS >
> struct operator_unary_minus_returns_void {
> // overloads of function returns_void make the difference
> // yes_type and no_type have different size by construction
> static ::boost::type_traits::yes_type returns_void(returns_void_t);
> static ::boost::type_traits::no_type returns_void(int);
> static const bool
> value=(sizeof(::boost::type_traits::yes_type)==sizeof(returns_void((-make(),returns_void_t()))));
> };
>

I'm not sure this works. Guiven the operator-() overloading for any, the
type of the expression

(-make(),returns_void_t())

is always returns_void_t, isn't it?

so the following expression would be always true

sizeof(::boost::type_traits::yes_type)==sizeof(returns_void((-make(),returns_void_t())))

Best,
Vicente

--
View this message in context: http://boost.2283326.n4.nabble.com/Review-Boost-Type-Traits-Extension-by-Frederic-Bron-tp3353283p3356066.html
Sent from the Boost - Dev mailing list archive at Nabble.com.

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