首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

CopyConstructible

指定可以从lvalue表达式...

所需

类型T满足CopyConstructible如果。

  • 类型T满足MoveConstructible,和给予。
  • v,一个洛值类型表达式Tconst 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)

代码语言:txt
复制
 ? cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com