NexusForce 1.0.0
A Modern C++ Library with extended functionality, web components, and utility libraries
载入中...
搜索中...
未找到
list< T, Alloc > 模板类 参考

双向链表容器 更多...

#include <list.hpp>

Public 类型

using pointer = T*
 指针类型
using reference = T&
 引用类型
using const_pointer = const T*
 常量指针类型
using const_reference = const T&
 常量引用类型
using value_type = T
 值类型
using size_type = size_t
 大小类型
using difference_type = ptrdiff_t
 差值类型
using iterator = list_iterator<false, list>
 迭代器类型
using const_iterator = list_iterator<true, list>
 常量迭代器类型
using reverse_iterator = _NEFORCE reverse_iterator<iterator>
 反向迭代器类型
using const_reverse_iterator = _NEFORCE reverse_iterator<const_iterator>
 常量反向迭代器类型
using allocator_type = Alloc
 分配器类型

Public 成员函数

 list ()
 默认构造函数
 list (size_type n)
 构造包含n个默认构造元素的链表
 list (size_type n, T &&value)
 构造包含n个指定值元素的链表
template<typename Iterator, enable_if_t< is_iter_v< Iterator >, int > = 0>
 list (Iterator first, Iterator last)
 范围构造函数
 list (std::initializer_list< T > ilist)
 初始化列表构造函数
listoperator= (std::initializer_list< T > ilist)
 初始化列表赋值运算符
 list (const list &other)
 拷贝构造函数
listoperator= (const list &other)
 拷贝赋值运算符
 list (list &&other) noexcept(is_nothrow_swappable_v< compressed_pair< allocator_type, size_type > >)
 移动构造函数
listoperator= (list &&other) noexcept(is_nothrow_swappable_v< compressed_pair< allocator_type, size_type > > &&is_nothrow_destructible_v< node_type >)
 移动赋值运算符
 ~list ()
 析构函数
NEFORCE_NODISCARD iterator begin () noexcept
 获取起始迭代器
NEFORCE_NODISCARD iterator end () noexcept
 获取结束迭代器
NEFORCE_NODISCARD const_iterator begin () const noexcept
 获取常量起始迭代器
NEFORCE_NODISCARD const_iterator end () const noexcept
 获取常量结束迭代器
NEFORCE_NODISCARD reverse_iterator rbegin () noexcept
 获取反向起始迭代器
NEFORCE_NODISCARD reverse_iterator rend () noexcept
 获取反向结束迭代器
NEFORCE_NODISCARD const_reverse_iterator rbegin () const noexcept
 获取常量反向起始迭代器
NEFORCE_NODISCARD const_reverse_iterator rend () const noexcept
 获取常量反向结束迭代器
NEFORCE_NODISCARD const_iterator cbegin () const noexcept
 获取常量起始迭代器
NEFORCE_NODISCARD const_iterator cend () const noexcept
 获取常量结束迭代器
NEFORCE_NODISCARD const_reverse_iterator crbegin () const noexcept
 获取常量反向起始迭代器
NEFORCE_NODISCARD const_reverse_iterator crend () const noexcept
 获取常量反向结束迭代器
NEFORCE_NODISCARD size_type size () const noexcept
 获取当前元素数量
NEFORCE_NODISCARD size_type max_size () const noexcept
 获取最大可能大小
NEFORCE_NODISCARD bool empty () const noexcept
 检查是否为空
NEFORCE_NODISCARD reference front () noexcept
 访问第一个元素
NEFORCE_NODISCARD const_reference front () const noexcept
 访问第一个常量元素
NEFORCE_NODISCARD reference back () noexcept
 访问最后一个元素
NEFORCE_NODISCARD const_reference back () const noexcept
 访问最后一个常量元素
template<typename... Args>
iterator emplace (iterator position, Args &&... args)
 在指定位置构造元素
template<typename... Args>
iterator emplace_back (Args &&... args)
 在末尾构造元素
template<typename... Args>
iterator emplace_front (Args &&... args)
 在开头构造元素
void push_front (const T &value)
 在开头拷贝插入元素
void push_front (T &&value)
 在开头移动插入元素
void push_back (const T &value)
 在末尾拷贝插入元素
void push_back (T &&value)
 在末尾移动插入元素
void pop_front () noexcept
 移除开头元素
void pop_back () noexcept
 移除末尾元素
void assign (const size_type n, const T &value)
 赋值n个指定值的元素
template<typename Iterator, enable_if_t< is_iter_v< Iterator >, int > = 0>
void assign (Iterator first, Iterator last)
 范围赋值
void assign (std::initializer_list< T > ilist)
 初始化列表赋值
iterator insert (iterator position, const T &value)
 在指定位置拷贝插入元素
iterator insert (iterator position, T &&value)
 在指定位置移动插入元素
template<typename Iterator, enable_if_t< is_iter_v< Iterator >, int > = 0>
void insert (iterator position, Iterator first, Iterator last)
 范围插入
void insert (iterator position, std::initializer_list< T > ilist)
 初始化列表插入
void insert (iterator position, size_type n, const T &value)
 插入n个指定值的元素
iterator erase (iterator position) noexcept(is_nothrow_destructible_v< node_type >)
 删除指定位置的元素
iterator erase (iterator first, iterator last) noexcept(is_nothrow_destructible_v< node_type >)
 删除指定范围内的元素
void clear () noexcept(is_nothrow_destructible_v< node_type >)
 清空链表
void swap (list &other) noexcept(is_nothrow_swappable_v< allocator_type >)
 交换两个链表的内容
void transfer (iterator position, iterator first, iterator last)
 传输元素
template<typename Pred>
void remove_if (Pred pred)
 根据谓词移除元素
void remove (const T &value)
 移除指定值的元素
void splice (iterator position, list &other)
 拼接整个链表
void splice (iterator position, list &other, iterator iter)
 拼接单个元素
void splice (iterator position, list &other, iterator first, iterator last)
 拼接范围内的元素
template<typename Pred>
void merge_if (list &other, Pred pred)
 合并两个有序链表
void merge (list &other)
 合并两个有序链表(默认使用小于比较)
void reverse () noexcept
 反转链表
template<typename Pred>
void unique_if (Pred pred) noexcept
 移除连续的重复元素
void unique () noexcept
 移除连续的重复元素(默认使用等于比较)
template<typename Pred>
void sort_if (Pred pred)
 对链表进行排序
void sort ()
 对链表进行排序(默认使用小于比较)
NEFORCE_NODISCARD const_reference at (size_type position) const
 常量索引访问
NEFORCE_NODISCARD reference at (size_type position)
 索引访问
NEFORCE_NODISCARD const_reference operator[] (const size_type position) const
 常量下标访问操作符
NEFORCE_NODISCARD reference operator[] (const size_type position)
 下标访问操作符
NEFORCE_NODISCARD bool operator== (const list &rhs) const noexcept(noexcept(_NEFORCE equal(cbegin(), cend(), rhs.cbegin())))
 相等比较操作符
NEFORCE_NODISCARD bool operator< (const list &rhs) const noexcept(noexcept(_NEFORCE lexicographical_compare(cbegin(), cend(), rhs.cbegin(), rhs.cend())))
 小于比较操作符

详细描述

template<typename T, typename Alloc = allocator<list_node<T>>>
class list< T, Alloc >

双向链表容器

模板参数
T元素类型
Alloc分配器类型

双向链表容器,提供常数时间的插入和删除操作。 不支持随机访问,但支持双向迭代。

在文件 list.hpp166 行定义.

构造及析构函数说明

◆ list() [1/7]

template<typename T, typename Alloc = allocator<list_node<T>>>
list< T, Alloc >::list ( )
inline

默认构造函数

构造一个空链表。

在文件 list.hpp249 行定义.

◆ list() [2/7]

template<typename T, typename Alloc = allocator<list_node<T>>>
list< T, Alloc >::list ( size_type n)
inlineexplicit

构造包含n个默认构造元素的链表

参数
n元素数量

在文件 list.hpp255 行定义.

◆ list() [3/7]

template<typename T, typename Alloc = allocator<list_node<T>>>
list< T, Alloc >::list ( size_type n,
T && value )
inline

构造包含n个指定值元素的链表

参数
n元素数量
value初始值

在文件 list.hpp263 行定义.

◆ list() [4/7]

template<typename T, typename Alloc = allocator<list_node<T>>>
template<typename Iterator, enable_if_t< is_iter_v< Iterator >, int > = 0>
list< T, Alloc >::list ( Iterator first,
Iterator last )
inline

范围构造函数

模板参数
Iterator迭代器类型
参数
first起始迭代器
last结束迭代器

在文件 list.hpp283 行定义.

◆ list() [5/7]

template<typename T, typename Alloc = allocator<list_node<T>>>
list< T, Alloc >::list ( std::initializer_list< T > ilist)
inline

初始化列表构造函数

参数
ilist初始化列表

在文件 list.hpp301 行定义.

◆ list() [6/7]

template<typename T, typename Alloc = allocator<list_node<T>>>
list< T, Alloc >::list ( const list< T, Alloc > & other)
inline

拷贝构造函数

参数
other源链表

在文件 list.hpp319 行定义.

◆ list() [7/7]

template<typename T, typename Alloc = allocator<list_node<T>>>
list< T, Alloc >::list ( list< T, Alloc > && other)
inlinenoexcept

移动构造函数

参数
other源链表

在文件 list.hpp340 行定义.

◆ ~list()

template<typename T, typename Alloc = allocator<list_node<T>>>
list< T, Alloc >::~list ( )
inline

析构函数

销毁所有元素并释放内存。

在文件 list.hpp365 行定义.

成员函数说明

◆ assign() [1/3]

template<typename T, typename Alloc = allocator<list_node<T>>>
void list< T, Alloc >::assign ( const size_type n,
const T & value )
inline

赋值n个指定值的元素

参数
n元素数量
value要赋的值

在文件 list.hpp580 行定义.

被这些函数引用 list< pair< Key, Value > >::assign().

◆ assign() [2/3]

template<typename T, typename Alloc = allocator<list_node<T>>>
template<typename Iterator, enable_if_t< is_iter_v< Iterator >, int > = 0>
void list< T, Alloc >::assign ( Iterator first,
Iterator last )
inline

范围赋值

模板参数
Iterator迭代器类型
参数
first起始迭代器
last结束迭代器

在文件 list.hpp592 行定义.

◆ assign() [3/3]

template<typename T, typename Alloc = allocator<list_node<T>>>
void list< T, Alloc >::assign ( std::initializer_list< T > ilist)
inline

初始化列表赋值

参数
ilist初始化列表

在文件 list.hpp601 行定义.

◆ at() [1/2]

template<typename T, typename Alloc = allocator<list_node<T>>>
NEFORCE_NODISCARD reference list< T, Alloc >::at ( size_type position)
inline

索引访问

参数
position索引位置
返回
指定位置元素的引用

在文件 list.hpp1016 行定义.

◆ at() [2/2]

template<typename T, typename Alloc = allocator<list_node<T>>>
NEFORCE_NODISCARD const_reference list< T, Alloc >::at ( size_type position) const
inline

常量索引访问

参数
position索引位置
返回
指定位置元素的常量引用

在文件 list.hpp1003 行定义.

被这些函数引用 list< pair< Key, Value > >::operator[]() , 以及 list< pair< Key, Value > >::operator[]().

◆ back() [1/2]

template<typename T, typename Alloc = allocator<list_node<T>>>
NEFORCE_NODISCARD const_reference list< T, Alloc >::back ( ) const
inlinenoexcept

访问最后一个常量元素

返回
最后一个元素的常量引用

在文件 list.hpp496 行定义.

◆ back() [2/2]

template<typename T, typename Alloc = allocator<list_node<T>>>
NEFORCE_NODISCARD reference list< T, Alloc >::back ( )
inlinenoexcept

访问最后一个元素

返回
最后一个元素的引用

在文件 list.hpp487 行定义.

◆ begin() [1/2]

template<typename T, typename Alloc = allocator<list_node<T>>>
NEFORCE_NODISCARD const_iterator list< T, Alloc >::begin ( ) const
inlinenoexcept

获取常量起始迭代器

返回
指向第一个元素的常量迭代器

在文件 list.hpp391 行定义.

◆ begin() [2/2]

◆ cbegin()

template<typename T, typename Alloc = allocator<list_node<T>>>
NEFORCE_NODISCARD const_iterator list< T, Alloc >::cbegin ( ) const
inlinenoexcept

◆ cend()

template<typename T, typename Alloc = allocator<list_node<T>>>
NEFORCE_NODISCARD const_iterator list< T, Alloc >::cend ( ) const
inlinenoexcept

获取常量结束迭代器

返回
指向无效元素的常量迭代器

在文件 list.hpp433 行定义.

被这些函数引用 list< pair< Key, Value > >::crbegin(), list< pair< Key, Value > >::end(), list< pair< Key, Value > >::operator<() , 以及 list< pair< Key, Value > >::operator==().

◆ clear()

template<typename T, typename Alloc = allocator<list_node<T>>>
void list< T, Alloc >::clear ( )
inlinenoexcept

◆ crbegin()

template<typename T, typename Alloc = allocator<list_node<T>>>
NEFORCE_NODISCARD const_reverse_iterator list< T, Alloc >::crbegin ( ) const
inlinenoexcept

获取常量反向起始迭代器

返回
指向无效元素的常量反向迭代器

在文件 list.hpp439 行定义.

被这些函数引用 list< pair< Key, Value > >::rbegin().

◆ crend()

template<typename T, typename Alloc = allocator<list_node<T>>>
NEFORCE_NODISCARD const_reverse_iterator list< T, Alloc >::crend ( ) const
inlinenoexcept

获取常量反向结束迭代器

返回
指向第一个元素的常量反向迭代器

在文件 list.hpp445 行定义.

被这些函数引用 list< pair< Key, Value > >::rend().

◆ emplace()

template<typename T, typename Alloc = allocator<list_node<T>>>
template<typename... Args>
iterator list< T, Alloc >::emplace ( iterator position,
Args &&... args )
inline

在指定位置构造元素

模板参数
Args构造参数类型
参数
position插入位置
args构造参数
返回
指向插入元素的迭代器

在文件 list.hpp509 行定义.

被这些函数引用 list< pair< Key, Value > >::emplace_back(), list< pair< Key, Value > >::emplace_front(), list< pair< Key, Value > >::insert(), list< pair< Key, Value > >::insert(), list< pair< Key, Value > >::list() , 以及 list< pair< Key, Value > >::list().

◆ emplace_back()

template<typename T, typename Alloc = allocator<list_node<T>>>
template<typename... Args>
iterator list< T, Alloc >::emplace_back ( Args &&... args)
inline

在末尾构造元素

模板参数
Args构造参数类型
参数
args构造参数
返回
指向插入元素的迭代器

在文件 list.hpp526 行定义.

◆ emplace_front()

template<typename T, typename Alloc = allocator<list_node<T>>>
template<typename... Args>
iterator list< T, Alloc >::emplace_front ( Args &&... args)
inline

在开头构造元素

模板参数
Args构造参数类型
参数
args构造参数
返回
指向插入元素的迭代器

在文件 list.hpp537 行定义.

◆ empty()

template<typename T, typename Alloc = allocator<list_node<T>>>
NEFORCE_NODISCARD bool list< T, Alloc >::empty ( ) const
inlinenoexcept

◆ end() [1/2]

template<typename T, typename Alloc = allocator<list_node<T>>>
NEFORCE_NODISCARD const_iterator list< T, Alloc >::end ( ) const
inlinenoexcept

获取常量结束迭代器

返回
指向无效元素的常量迭代器

在文件 list.hpp397 行定义.

◆ end() [2/2]

◆ erase() [1/2]

template<typename T, typename Alloc = allocator<list_node<T>>>
iterator list< T, Alloc >::erase ( iterator first,
iterator last )
inlinenoexcept

删除指定范围内的元素

参数
first起始迭代器
last结束迭代器
返回
指向最后一个被删除元素之后位置的迭代器

在文件 list.hpp747 行定义.

◆ erase() [2/2]

template<typename T, typename Alloc = allocator<list_node<T>>>
iterator list< T, Alloc >::erase ( iterator position)
inlinenoexcept

删除指定位置的元素

参数
position要删除的位置
返回
指向被删除元素之后位置的迭代器

在文件 list.hpp729 行定义.

被这些函数引用 list< pair< Key, Value > >::erase(), list< pair< Key, Value > >::pop_back(), list< pair< Key, Value > >::pop_front(), list< pair< Key, Value > >::remove_if() , 以及 list< pair< Key, Value > >::unique_if().

◆ front() [1/2]

template<typename T, typename Alloc = allocator<list_node<T>>>
NEFORCE_NODISCARD const_reference list< T, Alloc >::front ( ) const
inlinenoexcept

访问第一个常量元素

返回
第一个元素的常量引用

在文件 list.hpp478 行定义.

◆ front() [2/2]

template<typename T, typename Alloc = allocator<list_node<T>>>
NEFORCE_NODISCARD reference list< T, Alloc >::front ( )
inlinenoexcept

访问第一个元素

返回
第一个元素的引用

在文件 list.hpp469 行定义.

◆ insert() [1/5]

template<typename T, typename Alloc = allocator<list_node<T>>>
iterator list< T, Alloc >::insert ( iterator position,
const T & value )
inline

◆ insert() [2/5]

template<typename T, typename Alloc = allocator<list_node<T>>>
template<typename Iterator, enable_if_t< is_iter_v< Iterator >, int > = 0>
void list< T, Alloc >::insert ( iterator position,
Iterator first,
Iterator last )
inline

范围插入

模板参数
Iterator迭代器类型
参数
position插入位置
first起始迭代器
last结束迭代器

将[first, last)范围内的元素插入到position之前。 如果插入过程中发生异常,会回滚已插入的元素。

在文件 list.hpp630 行定义.

◆ insert() [3/5]

template<typename T, typename Alloc = allocator<list_node<T>>>
void list< T, Alloc >::insert ( iterator position,
size_type n,
const T & value )
inline

插入n个指定值的元素

参数
position插入位置
n元素数量
value要插入的值

如果插入过程中发生异常,会回滚已插入的元素。

在文件 list.hpp686 行定义.

◆ insert() [4/5]

template<typename T, typename Alloc = allocator<list_node<T>>>
void list< T, Alloc >::insert ( iterator position,
std::initializer_list< T > ilist )
inline

初始化列表插入

参数
position插入位置
ilist初始化列表

在文件 list.hpp674 行定义.

◆ insert() [5/5]

template<typename T, typename Alloc = allocator<list_node<T>>>
iterator list< T, Alloc >::insert ( iterator position,
T && value )
inline

在指定位置移动插入元素

参数
position插入位置
value要插入的值
返回
指向插入元素的迭代器

在文件 list.hpp617 行定义.

◆ max_size()

template<typename T, typename Alloc = allocator<list_node<T>>>
NEFORCE_NODISCARD size_type list< T, Alloc >::max_size ( ) const
inlinenoexcept

获取最大可能大小

返回
最大元素数量

在文件 list.hpp457 行定义.

◆ merge()

template<typename T, typename Alloc = allocator<list_node<T>>>
void list< T, Alloc >::merge ( list< T, Alloc > & other)
inline

合并两个有序链表(默认使用小于比较)

参数
other要合并的链表

在文件 list.hpp923 行定义.

◆ merge_if()

template<typename T, typename Alloc = allocator<list_node<T>>>
template<typename Pred>
void list< T, Alloc >::merge_if ( list< T, Alloc > & other,
Pred pred )
inline

合并两个有序链表

模板参数
Pred比较谓词类型
参数
other要合并的链表
pred二元比较谓词

将有序链表other合并到当前有序链表中,合并后仍保持有序。 使用pred作为比较准则。

在文件 list.hpp894 行定义.

被这些函数引用 list< pair< Key, Value > >::merge().

◆ operator<()

template<typename T, typename Alloc = allocator<list_node<T>>>
NEFORCE_NODISCARD bool list< T, Alloc >::operator< ( const list< T, Alloc > & rhs) const
inlinenoexcept

小于比较操作符

参数
rhs右侧链表
返回
按字典序比较结果

在文件 list.hpp1053 行定义.

◆ operator=() [1/3]

template<typename T, typename Alloc = allocator<list_node<T>>>
list & list< T, Alloc >::operator= ( const list< T, Alloc > & other)
inline

拷贝赋值运算符

参数
other源链表
返回
自身引用

在文件 list.hpp327 行定义.

◆ operator=() [2/3]

template<typename T, typename Alloc = allocator<list_node<T>>>
list & list< T, Alloc >::operator= ( list< T, Alloc > && other)
inlinenoexcept

移动赋值运算符

参数
other源链表
返回
自身引用

在文件 list.hpp350 行定义.

◆ operator=() [3/3]

template<typename T, typename Alloc = allocator<list_node<T>>>
list & list< T, Alloc >::operator= ( std::initializer_list< T > ilist)
inline

初始化列表赋值运算符

参数
ilist初始化列表
返回
自身引用

在文件 list.hpp309 行定义.

◆ operator==()

template<typename T, typename Alloc = allocator<list_node<T>>>
NEFORCE_NODISCARD bool list< T, Alloc >::operator== ( const list< T, Alloc > & rhs) const
inlinenoexcept

相等比较操作符

参数
rhs右侧链表
返回
如果两个链表大小相等且对应元素相等返回true

在文件 list.hpp1043 行定义.

◆ operator[]() [1/2]

template<typename T, typename Alloc = allocator<list_node<T>>>
NEFORCE_NODISCARD reference list< T, Alloc >::operator[] ( const size_type position)
inline

下标访问操作符

参数
position索引位置
返回
指定位置元素的引用

在文件 list.hpp1036 行定义.

◆ operator[]() [2/2]

template<typename T, typename Alloc = allocator<list_node<T>>>
NEFORCE_NODISCARD const_reference list< T, Alloc >::operator[] ( const size_type position) const
inline

常量下标访问操作符

参数
position索引位置
返回
指定位置元素的常量引用

在文件 list.hpp1029 行定义.

◆ push_back() [1/2]

template<typename T, typename Alloc = allocator<list_node<T>>>
void list< T, Alloc >::push_back ( const T & value)
inline

在末尾拷贝插入元素

参数
value要插入的值

在文件 list.hpp557 行定义.

◆ push_back() [2/2]

template<typename T, typename Alloc = allocator<list_node<T>>>
void list< T, Alloc >::push_back ( T && value)
inline

在末尾移动插入元素

参数
value要插入的值

在文件 list.hpp563 行定义.

◆ push_front() [1/2]

template<typename T, typename Alloc = allocator<list_node<T>>>
void list< T, Alloc >::push_front ( const T & value)
inline

在开头拷贝插入元素

参数
value要插入的值

在文件 list.hpp545 行定义.

◆ push_front() [2/2]

template<typename T, typename Alloc = allocator<list_node<T>>>
void list< T, Alloc >::push_front ( T && value)
inline

在开头移动插入元素

参数
value要插入的值

在文件 list.hpp551 行定义.

◆ rbegin() [1/2]

template<typename T, typename Alloc = allocator<list_node<T>>>
NEFORCE_NODISCARD const_reverse_iterator list< T, Alloc >::rbegin ( ) const
inlinenoexcept

获取常量反向起始迭代器

返回
指向无效元素的常量反向迭代器

在文件 list.hpp415 行定义.

◆ rbegin() [2/2]

template<typename T, typename Alloc = allocator<list_node<T>>>
NEFORCE_NODISCARD reverse_iterator list< T, Alloc >::rbegin ( )
inlinenoexcept

获取反向起始迭代器

返回
指向无效元素的反向迭代器

在文件 list.hpp403 行定义.

◆ remove()

template<typename T, typename Alloc = allocator<list_node<T>>>
void list< T, Alloc >::remove ( const T & value)
inline

移除指定值的元素

参数
value要移除的值

在文件 list.hpp823 行定义.

◆ remove_if()

template<typename T, typename Alloc = allocator<list_node<T>>>
template<typename Pred>
void list< T, Alloc >::remove_if ( Pred pred)
inline

根据谓词移除元素

模板参数
Pred谓词类型
参数
pred一元谓词,返回true的元素将被移除

在文件 list.hpp808 行定义.

被这些函数引用 list< pair< Key, Value > >::remove().

◆ rend() [1/2]

template<typename T, typename Alloc = allocator<list_node<T>>>
NEFORCE_NODISCARD const_reverse_iterator list< T, Alloc >::rend ( ) const
inlinenoexcept

获取常量反向结束迭代器

返回
指向第一个元素的常量反向迭代器

在文件 list.hpp421 行定义.

◆ rend() [2/2]

template<typename T, typename Alloc = allocator<list_node<T>>>
NEFORCE_NODISCARD reverse_iterator list< T, Alloc >::rend ( )
inlinenoexcept

获取反向结束迭代器

返回
指向第一个元素的反向迭代器

在文件 list.hpp409 行定义.

◆ size()

template<typename T, typename Alloc = allocator<list_node<T>>>
NEFORCE_NODISCARD size_type list< T, Alloc >::size ( ) const
inlinenoexcept

获取当前元素数量

返回
元素数量

在文件 list.hpp451 行定义.

被这些函数引用 list< pair< Key, Value > >::operator==().

◆ sort_if()

template<typename T, typename Alloc = allocator<list_node<T>>>
template<typename Pred>
void list< T, Alloc >::sort_if ( Pred pred)
inline

对链表进行排序

模板参数
Pred比较谓词类型
参数
pred二元比较谓词

使用插入排序算法对链表进行排序。

在文件 list.hpp976 行定义.

被这些函数引用 list< pair< Key, Value > >::sort().

◆ splice() [1/3]

template<typename T, typename Alloc = allocator<list_node<T>>>
void list< T, Alloc >::splice ( iterator position,
list< T, Alloc > & other )
inline

拼接整个链表

参数
position目标位置
other源链表

将other链表的所有元素拼接到position之前,other变为空链表。

在文件 list.hpp834 行定义.

◆ splice() [2/3]

template<typename T, typename Alloc = allocator<list_node<T>>>
void list< T, Alloc >::splice ( iterator position,
list< T, Alloc > & other,
iterator first,
iterator last )
inline

拼接范围内的元素

参数
position目标位置
other源链表
first起始迭代器
last结束迭代器

将other链表中[first, last)范围内的元素拼接到position之前。

在文件 list.hpp871 行定义.

◆ splice() [3/3]

template<typename T, typename Alloc = allocator<list_node<T>>>
void list< T, Alloc >::splice ( iterator position,
list< T, Alloc > & other,
iterator iter )
inline

拼接单个元素

参数
position目标位置
other源链表
iter指向要拼接元素的迭代器

将other链表中的iter指向的元素拼接到position之前。

在文件 list.hpp851 行定义.

◆ swap()

template<typename T, typename Alloc = allocator<list_node<T>>>
void list< T, Alloc >::swap ( list< T, Alloc > & other)
inlinenoexcept

交换两个链表的内容

参数
other要交换的另一个链表

在文件 list.hpp775 行定义.

被这些函数引用 list< pair< Key, Value > >::list(), list< pair< Key, Value > >::operator=() , 以及 list< pair< Key, Value > >::operator=().

◆ transfer()

template<typename T, typename Alloc = allocator<list_node<T>>>
void list< T, Alloc >::transfer ( iterator position,
iterator first,
iterator last )
inline

传输元素

参数
position目标位置
first起始迭代器
last结束迭代器

将[first, last)范围内的元素从当前链表传输到position之前。 此操作为常数时间,不涉及元素构造和析构。

在文件 list.hpp789 行定义.

被这些函数引用 list< pair< Key, Value > >::merge_if(), list< pair< Key, Value > >::splice(), list< pair< Key, Value > >::splice() , 以及 list< pair< Key, Value > >::splice().

◆ unique_if()

template<typename T, typename Alloc = allocator<list_node<T>>>
template<typename Pred>
void list< T, Alloc >::unique_if ( Pred pred)
inlinenoexcept

移除连续的重复元素

模板参数
Pred二元谓词类型
参数
pred用于判断两个元素是否相等的谓词

移除链表中所有连续重复的元素,只保留第一个。

在文件 list.hpp947 行定义.

被这些函数引用 list< pair< Key, Value > >::unique().


该类的文档由以下文件生成: