std::forward_list<T,Allocator>:: emplace_front
From cppreference.net
<
cpp
|
container
|
forward list
C++
Containers library
|
(C++17)
|
||||
| Sequence | ||||
|
(C++11)
|
||||
|
(C++26)
|
||||
|
(C++26)
|
||||
|
(C++11)
|
||||
| Associative | ||||
| Unordered associative | ||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
| Adaptors | ||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
| Views | ||||
|
(C++20)
|
||||
|
(C++23)
|
||||
| Tables | ||||
| Iterator invalidation | ||||
| Member function table | ||||
| Non-member function table |
std::forward_list
| Member functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Non-member functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Deduction guides (C++17) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
template
<
class
...
Args
>
void emplace_front ( Args && ... args ) ; |
(自 C++11 起)
(直至 C++17) |
|
|
template
<
class
...
Args
>
reference emplace_front ( Args && ... args ) ; |
(自 C++17 起)
(自 C++26 起为 constexpr) |
|
在容器起始位置插入新元素。该元素通过 std::allocator_traits::construct 构造,通常使用原位构造的 new 操作在容器提供的位置直接构建元素。参数 args... 会以 std:: forward < Args > ( args ) ... 形式转发给构造函数。
不会使任何迭代器或引用失效。
目录 |
参数
| args | - | 要转发给元素构造函数的参数 |
| 类型要求 | ||
-
T
不能通过
args...
被
EmplaceConstructible
到
forward_list
中,则行为未定义。
|
||
返回值
| (无) | (C++17 前) |
| 指向被插入元素的引用。 | (C++17 起) |
复杂度
常量。
异常
若因任何原因抛出异常,此函数不产生任何效果( 强异常安全保证 )。
参见
|
在开头插入元素
(公开成员函数) |