MoveInsertable
指定类型的对象可以由给定的分配器从该类型的rvalue构造为未初始化的存储。
所需
类型T
是MoveInsertable
进入容器X
谁的value_type
是相同的T
如果,给予。
A | an allocator type |
---|---|
m | an lvalue of type A |
p | the pointer of type T* prepared by the container |
rv | rvalue expression of type T |
何地X::allocator_type
是相同的std::allocator_traits<A>::rebind_alloc<T>
,,,
下列表达式格式良好:
二次
std::allocator_traits<A>::construct(m, p, rv);
二次
经评估后,*p
等于以前持有的价值。rv
%28rv
仍然有效,但处于未指定状态。%29。
如果X
如果不知道分配器,则该术语的定义为A
成std::allocator<T>
,除非不需要创建分配器对象,并且用户定义的专门化为std::allocator
没有实例化。
注记
如果A
是std::allocator<T>
,然后这将称为安置-新的,如::new((void*)p) T(rv)
...
如果std::allocator<T>
或者使用类似的分配器,类不必实现移动构造函数为了满足这种类型的要求:复制构造函数这需要一个const T&
参数可以绑定rvalue表达式。如果一个MoveInsertable类实现了一个Move构造函数,那么它也可以实现移动语义利用以下事实rv
施工后未具体说明。
另见
CopyInsertable
*。
© cppreference.com
在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com