Boost logo

Boost :

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


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

These traits are really important to conform with some of the C++11
interfaces. Next follows one examples from the standard:

template (*class... UTypes*)
explicit tuple(UTypes&&... u) noexcept;
8 Requires: sizeof...(Types) == sizeof...(UTypes). is_constructible(*Ti,
Ui&& *)::value is true
for all i.
10 Remark: This constructor shall not participate in overload resolution
unless each type in UTypes is
implicitly convertible to its corresponding type in Types.

In Boost there are some libraries as Boost.Array, Boost.Fusion tuple that
defines these kind of constructors or assignments and that require that the
template types must be constructible or assignable.

The problem when these constructors/assignments don't use of SFINAE to avoid
that these functions participate on overload resolution is that
is_constructible or is_assignable will give false positive results as the
expression could be valid, even if the definition doesn't compiles.

I don't know if it is worth including these traits in Boost when the
compiler supports decltype so we can start writing conforming interfaces,
but at least it would be nice if the Boost libraries start using these
standard traits when them are available.

Any thoughts?


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