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

std::multiset::emplace

template< class... Args > iterator emplace( Args&&... args );

(since C++11)

将一个新元素插入到在给定的容器中构造的容器中。args...

谨慎使用emplace允许构造新元素,同时避免不必要的复制或移动操作。调用新元素的构造函数的参数与提供给emplace,通过std::forward<Args>(args)......

没有迭代器或引用无效。

参数

args

-

arguments to forward to the constructor of the element

返回值

将迭代器返回到插入的元素。

例外

如果任何操作引发异常,则此函数没有任何效果。

复杂性

容器大小的对数。

另见

emplace_hint (C++11)

constructs elements in-place using a hint (public member function)

insert

inserts elements or nodes (since C++17) (public member function)

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

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

扫码关注腾讯云开发者

领取腾讯云代金券