Boost logo

Boost :

Subject: Re: [boost] [type_traits] is_constructible, ... when decltype is supported?
From: Vicente Botet (vicente.botet_at_[hidden])
Date: 2011-06-07 13:15:05


Mathias Gaunard-2 wrote:
>
> On 05/06/2011 22:32, Vicente Botet wrote:
>
>> We can use it as the return type of the test function. FOr example to
>> test
>> if T can be constructed with two parameters A1, A2
>>
>> decltype((T(declval<A1>(),declval<A2>()), true_type())) test(int);
>> false_type test(...);
>
> You realize you can do the same thing with sizeof in C++03, when
> BOOST_NO_SFINAE_EXPR is not defined?
>
> Also you shouldn't use decltype directly in the return type if you want
> portability, it caused mangling problems with some GCC versions.
>
> Attached is a C++03-compatible version.
>
>

Hi, glad to see that a C++03 version works. Unfortunately it seems that only
gcc since 4.4 supports this.

Anyway I agree that your solution should be more portable.

Best,
Vicente

--
View this message in context: http://boost.2283326.n4.nabble.com/type-traits-is-constructible-when-decltype-is-supported-tp3575452p3580227.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