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

DefaultInsertable

指定类型的实例可以由给定的分配器默认构造.

所需

类型TDefaultInsertable进入ContainerX谁的value_type是相同的T如果,给予。

A

an allocator type

m

an lvalue of type A

p

the pointer of type T* prepared by the container

何地X::allocator_type是相同的std::allocator_traits<A>::rebind_alloc<T>,,,

下列表达式格式良好:

二次

代码语言:javascript
复制
std::allocator_traits<A>::construct(m, p);

二次

如果X如果不知道分配器,则该术语的定义为Astd::allocator<T>,除非不需要创建分配器对象,并且用户定义的专门化为std::allocator没有实例化。

注记

默认情况下,这将称为新的定位,如::new((void*)p) T()28%,即,值初始化指向的对象p29%。如果值初始化是不可取的,例如,如果对象是非类类型的,并且不需要零出,则可以通过提供自定义分配器::构造...

另见

可破坏性

*。

CopyInsertable

MoveInsertable

EmplaceConstrucable

可擦除

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

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

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com