命名空间
变体
操作

std::list<T,Allocator>::emplace_front

来自 cppreference.cn
< cpp‎ | container‎ | list
 
 
 
 
template< class... Args >
void emplace_front( Args&&... args );
(since C++11)
(until C++17)
template< class... Args >
reference emplace_front( Args&&... args );
(since C++17)

在容器的起始处插入新元素。该元素通过 std::allocator_traits::construct 构造,它通常使用 placement-new 在容器提供的位置就地构造元素。实参 args... 作为 std::forward<Args>(args)... 转发给构造函数。

没有迭代器或引用会失效。

目录

[编辑] 参数

args - 转发给元素构造函数的参数
类型要求
-
T (容器的元素类型) 必须满足 EmplaceConstructible 的要求。

[编辑] 返回值

(无) (until C++17)
插入元素的引用。 (since C++17)

[编辑] 复杂度

常数。

[编辑] 异常

如果由于任何原因抛出异常,此函数没有效果(强异常安全保证)。

[编辑] 参见

在起始处插入一个元素
(公有成员函数) [编辑]