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:
> 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


View this message in context:
Sent from the Boost - Dev mailing list archive at

Boost list run by bdawes at, gregod at, cpdaniel at, john at