Boost logo

Boost :

Subject: Re: [boost] [type_traits] copy constructor
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2011-09-29 17:02:57

Le 29/09/11 19:12, lcaminiti a écrit :
> Vicente Botet wrote:
>> Le 29/09/11 04:57, Lorenzo Caminiti a écrit :
>>> Hello all,
>>> What's the most portable way to detect if a type T is CopyConstructible?
>>> Actually, I would need a metafunction that is true_ iff a type T has a
>>> const-correct copy construct:
>>> T::T( T const& other) { /* copy this T from the other T */ }
>>> (I've been looking at boost::has_trivial_copy and
>>> boost::has_nothrow_copy but I wanted to double check with the ML.)
>> Hi,
>> The proposed Boost.Conversion provides some interesting traits (included
>> in C++11) that you could be interested in.
>> is_constructible, is_default_constructible, is_copy_constructible,
>> is_move_constructible as well as is_assignable, is_copy_assignable and
>> is_move_assignable.
>> If John is interested in we can work together to include them in
>> TypeTraits.
> Thanks a lot Vicente. For now, I'm sticking with C++03 but I have a list of
> extra features that Boost.Contract could support with C++11 for future work.
> I'll add this (important) feature to the list.
The definition of these traits relies on SFINAE for expressions which is
an optional feature for C++03 and mandatory for C++11.

Unfortunately this feature is not supported most of C++03 compilers and
even msvc 10 which supports some c++11 features doesn't support it.


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