CopyConstructible
C++概念:CopyConstrucable
指定可以从lvalue表达式...
所需
类型T
满足CopyConstructible
如果。
- 类型
T
满足MoveConstructible
,和给予。
v
,一个洛值类型表达式T
或const T
或者r值类型表达式const T
u
,任意标识符
下列表达式必须有效并具有指定的效果。
Expression | Post-conditions |
---|---|
T u = v; | The value of u is equivalent to the value of v. The value of v is unchanged. |
T(v) | The value of T(v) is equivalent to the value of v. The value of v is unchanged. |
The expression v.~T() also must be valid, and, for lvalue v, the expression &v must have the type T* or const T* and must evaluate to the address of v. | (until C++11) |
---|
注记
直到C++11,类重载operator&
不是CopyConstructible
因此,%27T在标准库容器中是可用的。从C++11开始,标准库使用std::addressof
每当需要对象的地址时。
另见
is_copy_constructibleis_trivially_copy_constructibleis_nothrow_copy_constructible (C++11)(C++11)(C++11) | checks if a type has a copy constructor (class template) |
---|
© cppreference.com
在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。