This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of CD1 status.
has_nothrow_copy_constructor<T>::value
is true if T
has 'a' nothrow copy constructor.Section: 21.3.5.4 [meta.unary.prop] Status: CD1 Submitter: Alisdair Meredith Opened: 2007-10-10 Last modified: 2016-01-28
Priority: Not Prioritized
View other active issues in [meta.unary.prop].
View all other issues in [meta.unary.prop].
View all issues with CD1 status.
Discussion:
Unfortunately a class can have multiple copy constructors, and I believe to be useful this trait should only return true is ALL copy constructors are no-throw.
For instance:
struct awkward { awkward( const awkward & ) throw() {} awkward( awkward & ) { throw "oops"; } };
Proposed resolution:
Change 21.3.5.4 [meta.unary.prop]:
has_trivial_copy_constructor
T
is a trivial type (3.9) or a reference type or a class typewith a trivial copy constructorwhere all copy constructors are trivial (12.8).
has_trivial_assign
T
is neitherconst
nor a reference type, andT
is a trivial type (3.9) or a class typewith a trivial copy assignment operatorwhere all copy assignment operators are trivial (12.8).
has_nothrow_copy_constructor
has_trivial_copy_constructor<T>::value
istrue
orT
is a class typewith awhere all copy constructorsthat isare known not to throw any exceptions orT
is an array of such a class type
has_nothrow_assign
T
is neitherconst
nor a reference type, andhas_trivial_assign<T>::value
istrue
orT
is a class typewith awhere all copy assignment operators takeingan lvalue of typeT
that is known not to throw any exceptions orT
is an array of such a class type.