Boost logo

Boost :

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


Steven Watanabe-4 wrote:
>
> AMDG
>
> On 06/05/2011 11:06 AM, Vicente Botet wrote:
>> when decltype is supported (as it is the case for gcc 4.6.0) we can
>> define
>> the C++0x traits is_constructible, is_assignable and the ones that depend
>> on
>> them.
>>
>
> How exactly does decltype allow you to implement
> is_constructible?
>
>

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(...);

Unfortunately, Boost.TypeOf can not be used for the failing checks, as
compilation fails.

I have committed them in the sandbox under
conversion/boost/conversion/type_traits.

Best,
Vicente

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