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

std::priority_queue::emplace

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

(since C++11)

将新元素推入优先级队列。元素是就地构造的,即不执行复制或移动操作。调用元素的构造函数的参数与提供给函数的参数完全相同。

有效呼叫c.emplace_back(std::forward<Args>(args)...);std::push_heap(c.begin(), c.end(), comp);

参数

args

-

arguments to forward to the constructor of the element

返回值

%280%29

复杂性

比较的对数数加上Container::emplace_back...

另见

push

inserts element and sorts the underlying container (public member function)

pop

removes the top element (public member function)

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

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

扫码关注腾讯云开发者

领取腾讯云代金券