名稱空間
變體
操作

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

來自 cppreference.com
< cpp‎ | 容器‎ | deque
 
 
 
 
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)...

所有迭代器(包括 end() 迭代器)都將失效。無引用失效。

目錄

[編輯] 引數

args - 轉發給元素建構函式的引數
型別要求
-
T (容器的元素型別) 必須滿足 EmplaceConstructible 的要求。

[編輯] 返回值

(無) (C++17 前)
對插入元素的引用。 (C++17 起)

[編輯] 複雜度

常數時間。

[編輯] 異常

如果由於任何原因丟擲異常,此函式無效果(強異常安全保證)。

[編輯] 參閱

插入元素到起始
(public member function) [編輯]