SimpleWindow
载入中...
搜索中...
未找到
sw::List< T > 模板类 参考

列表类,内部维护了一个指向std::vector的智能指针 更多...

#include <List.h>

Public 成员函数

 List ()
 初始化列表
 
 List (std::initializer_list< T > list)
 使用初始化列表
 
 List (int capacity)
 初始化列表并指定容量
 
auto begin () const
 正向迭代器开始
 
auto end () const
 正向迭代器结束
 
auto rbegin () const
 反向迭代器开始
 
auto rend () const
 反向迭代器结束
 
auto & operator[] (int index) const
 获取或设置列表中指定位置的值
 
bool operator== (const List &other) const
 判断是否为同一个列表
 
bool operator!= (const List &other) const
 判断是否不是同一个列表
 
int Capacity () const
 列表当前的容量
 
int Count () const
 获取元素个数
 
bool IsEmpty () const
 列表是否为空
 
auto Append (const T &value) const
 添加一个值到列表末尾
 
auto Append (T &&value) const
 添加一个值到列表末尾
 
auto Insert (int index, const T &value) const
 在指定位置插入值
 
auto Insert (int index, T &&value) const
 在指定位置插入值
 
bool Contains (const T &value) const
 列表是否包含某个值
 
int IndexOf (const T &value) const
 查找值在列表中的索引
 
bool Remove (const T &value) const
 移除列表中第一个指定的值
 
void RemoveAt (int index) const
 移除指定索引处的值
 
void Clear () const
 清空列表
 
List Copy () const
 复制当前列表
 

友元

std::wostream & operator<< (std::wostream &wos, const List &list)
 支持Utils::BuildStr
 

详细描述

template<typename T>
class sw::List< T >

列表类,内部维护了一个指向std::vector的智能指针

成员函数说明

◆ Append() [1/2]

template<typename T >
auto sw::List< T >::Append ( const T & value) const
inline

添加一个值到列表末尾

返回
当前列表

◆ Append() [2/2]

template<typename T >
auto sw::List< T >::Append ( T && value) const
inline

添加一个值到列表末尾

返回
当前列表

◆ Contains()

template<typename T >
bool sw::List< T >::Contains ( const T & value) const
inline

列表是否包含某个值

参数
value要查找的值

◆ IndexOf()

template<typename T >
int sw::List< T >::IndexOf ( const T & value) const
inline

查找值在列表中的索引

参数
value要查找的值
返回
若列表中包含该值则返回其索引,否则返回-1

◆ Insert() [1/2]

template<typename T >
auto sw::List< T >::Insert ( int index,
const T & value ) const
inline

在指定位置插入值

返回
当前列表

◆ Insert() [2/2]

template<typename T >
auto sw::List< T >::Insert ( int index,
T && value ) const
inline

在指定位置插入值

返回
当前列表

◆ Remove()

template<typename T >
bool sw::List< T >::Remove ( const T & value) const
inline

移除列表中第一个指定的值

参数
value要移除的值
返回
是否成功移除

◆ RemoveAt()

template<typename T >
void sw::List< T >::RemoveAt ( int index) const
inline

移除指定索引处的值

参数
index要移除元素的索引

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