命名空间
变体
操作

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

来自 cppreference.cn
< cpp‎ | 容器‎ | forward list
 
 
 
 
template< class... Args >
void emplace_front( Args&&... args );
(始于 C++11)
(截至 C++17)
template< class... Args >
reference emplace_front( Args&&... args );
(始于 C++17)

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

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

目录

[编辑] 参数

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

[编辑] 返回值

(无) (截至 C++17)
对插入元素的引用。 (始于 C++17)

[编辑] 复杂度

常数。

[编辑] 异常

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

[编辑] 参见

在开头插入一个元素
(公共成员函数) [编辑]