在线文档教程
C++
容器 | Containers

std::queue::emplace

STD::Queue::Emplace

template< class... Args > void emplace( Args&&... args (since C++11) (until C++17)
template< class... Args > reference emplace( Args&&... args (since C++17)

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

有效呼叫return c.emplace_back(std::forward<Args>(args)...

参数

args-arguments to forward to the constructor of the element

返回值

(none)(until C++17)
A reference to the new element.(since C++17)

复杂性

与…的复杂性相同Container::emplace_back...

另见

pushinserts element at the end (public member function)
popremoves the first element (public member function)

© cppreference.com

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

http://en.cppreference.com/w/cpp/容器/Queue/emplace