RLib  5.7
RLib - an opensource, lightweight and multi-platform framework for cpp programming
System::Collections::Generic::List< R, disposer, allocator > Class Template Reference

Represents a doubly linked list. Provides methods to search, sort, and manipulate lists More...

Public Types

typedef ListNode * ListNodePointer
 
typedef R Type
 Represents the Type of the current instance More...
 
typedef ListIterator< R, ListNodePointer > Iterator
 

Public Member Functions

 List (intptr_t cache_capcity=RLIB_DEFAULT_CAPACITY)
 
 List (const List< R > &list_from)
 
 List (const Standard::initializer_list< const R > &data)
 
void InitStorage (intptr_t cache_count)
 Creates back storage for caching. This function helps speed up the insertion of List that have a large number of elements, by avoiding the frequent memory allocation More...
 
void ReleaseStorage ()
 destroy back storage More...
 
intptr_t GetSafeLength () const
 安全获取 List<Of R> 中实际包含的元素数 More...
 
 RLIB_PROPERTY_GET (intptr_t SafeLength, GetSafeLength)
 安全获取 List<Of R> 中实际包含的元素数 More...
 
RLIB_FORCE_INLINE R * GetType () const
 Gets the Type of the current instance More...
 
intptr_t GetLength () const
 获取 List<Of R> 中实际包含的元素数 More...
 
 RLIB_PROPERTY_GET (const intptr_t Length, GetLength)
 获取 List<Of R> 中实际包含的元素数 More...
 
template<typename disposer = IDisposable<R>>
void Clear ()
 List<Of R> 中移除所有元素 More...
 
List< R > & operator= (const List< R > &obj)
 赋值运算符 复制对象 More...
 
Listoperator+= (const R &item)
 拓展运算符 添加对象 More...
 
template<class... P>
ListNodePointer Add (P &&...args)
 
template<class... P>
ListNodePointer AddFirst (P &&...args)
 将对象添加到 List<Of R> 的开始处 More...
 
template<class... P>
ListNodePointer AddLast (P &&...args)
 将对象添加到 List<Of R> 的结尾处 More...
 
template<typename... Args>
ListNodePointer AddRange (const R &item)
 添加指定元素到 List<Of R> 的末尾, 并返回首元素链节点指针 More...
 
template<typename... Args>
ListNodePointer AddRange (const R &item, const Args &...args)
 添加指定元素到 List<Of R> 的末尾, 并返回首元素链节点指针 More...
 
template<intptr_t N>
ListNodePointer AddRange (const R(&items)[N])
 将指定集合的元素添加到 List<Of R> 的末尾, 并返回首元素链节点指针 More...
 
ListNodePointer AddRange (const R items[], intptr_t count)
 将指定集合的元素添加到 List<Of R> 的末尾, 并返回首元素链节点指针 More...
 
Array< R > * ToArray (intptr_t count=0)
 List<Of R> 的值转换成 Array<Of R> More...
 
bool Contains (const R &item) const
 确定某元素是否在 List<Of R> 中 More...
 
ListNodePointer Insert (const R &item, const R &itemToInsert, typename IComparer< R >::EqualsDelegate equals)
 将元素插入 List<Of R> 的指定元素前面, 否则插入末尾 More...
 
template<typename IComparer< R >::EqualsDelegate equals = IComparer<R>::Equals>
ListNodePointer Insert (const R &item, const R &itemToInsert)
 将元素插入 List<Of R> 的指定元素前面 More...
 
ListNodePointer Insert (ListNodePointer pNode, const R &item)
 将元素插入 List<Of R> 的指定元素前面 More...
 
ListNodePointer InsertAt (intptr_t order, const R &item)
 将元素插入 List<Of R> 的从零开始的指定位置顺序前面 More...
 
ListNodePointer InsertRange (const R &item, const R *itemsToInsert, intptr_t count)
 将集合中的某个元素插入 List<Of R> 的指定指定元素前面 More...
 
bool Remove (const R &item, typename IComparer< R >::EqualsDelegate equals)
 List<Of R> 中移除特定对象的第一个匹配项 More...
 
template<typename IComparer< R >::EqualsDelegate equals = IComparer<R>::Equals>
bool Remove (const R &item)
 List<Of R> 中移除特定对象的第一个匹配项 More...
 
void Remove (ListNodePointer pNode)
 List<Of R> 中移除特定链节点 More...
 
bool RemoveAt (intptr_t order)
 List<Of R> 中移除指定位置顺序的对象 More...
 
intptr_t RemoveAll (const R &item)
 移除与特定对象相匹配的所有元素 More...
 
bool RemoveFirst ()
 移除位于 List<Of R> 开头处的节点 More...
 
bool RemoveLast ()
 移除位于 List<Of R> 结尾处的节点 More...
 
R & operator[] (intptr_t order) const
 获取 List<Of R> 中指定位置的元素 More...
 
R & Get (intptr_t order) const
 获取 List<Of R> 中指定顺序(从0开始)的元素 More...
 
bool IsNull (const R &Node) const
 判断获取到的对象是否为空引用 More...
 
ListNodePointer GetListNode (intptr_t order) const
 获取 List<Of R> 中指定顺序(从0开始)的元素的链节点指针 More...
 
void Reverse (intptr_t order=0, intptr_t count=0)
 将指定范围中元素的顺序反转 More...
 
intptr_t IndexOf (const R &item, typename IComparer< R >::EqualsDelegate equals) const
 搜索指定的对象,并返回整个 List<Of R> 中第一个匹配项的从零开始的位置顺序 More...
 
template<typename IComparer< R >::EqualsDelegate equals = IComparer<R>::Equals>
intptr_t IndexOf (const R &item) const
 搜索指定的对象,并返回整个 List<Of R> 中第一个匹配项的从零开始的位置顺序 More...
 
intptr_t LastIndexOf (const R &item, typename IComparer< R >::EqualsDelegate equals) const
 搜索指定的对象,并返回整个 List<Of R> 中最后一个匹配项的从零开始的位置顺序 More...
 
template<typename IComparer< R >::EqualsDelegate equals = IComparer<R>::Equals>
intptr_t LastIndexOf (const R &item) const
 搜索指定的对象,并返回整个 List<Of R> 中最后一个匹配项的从零开始的位置顺序 More...
 
void Unique ()
 删除 List<Of R> 中所有重复的相邻元素 More...
 
void Sort (typename IComparer< R >::Delegate comparer=IComparer< R >::Compare, intptr_t begin=0, intptr_t count=-1)
 List<Of R> 进行简单选择排序 More...
 
template<typename comparer = IComparer<R>>
void Sort (intptr_t begin=0, intptr_t count=-1)
 List<Of R> 进行简单选择排序 More...
 
template<class collection_t >
void CopyTo (collection_t &obj) const
 List<Of R> 完全拷贝至指定集合处 More...
 
void MoveTo (List< R > &obj)
 List<Of R> 完全转移至另一 List<Of R> 处 More...
 
void MoveFirst (ListNodePointer pNode)
 Moves the specified element to the first place More...
 
void MoveLast (ListNodePointer pNode)
 Moves the specified element to the last place More...
 
Iterator begin ()
 Returns an iterator to the first element of the container. If the container is empty or nothing, the returned iterator will be equal to end() More...
 
const Iterator begin () const
 
Iterator end ()
 Returns an iterator to the element following the last element of the container. This element acts as a placeholder; attempting to access it results in undefined behavior. More...
 
const Iterator end () const
 

Public Attributes

 RLIB_DECLARE_DYNCREATE
 

Protected Attributes

intptr_t Count
 

Detailed Description

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
class System::Collections::Generic::List< R, disposer, allocator >

Represents a doubly linked list. Provides methods to search, sort, and manipulate lists

Member Typedef Documentation

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
typedef R System::Collections::Generic::List< R, disposer, allocator >::Type

Represents the Type of the current instance

Member Function Documentation

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
template<class... P>
ListNodePointer System::Collections::Generic::List< R, disposer, allocator >::Add ( P &&...  args)
inline

See also
AddLast
template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
template<class... P>
ListNodePointer System::Collections::Generic::List< R, disposer, allocator >::AddFirst ( P &&...  args)
inline

将对象添加到 List<Of R> 的开始处

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
template<class... P>
ListNodePointer System::Collections::Generic::List< R, disposer, allocator >::AddLast ( P &&...  args)
inline

将对象添加到 List<Of R> 的结尾处

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
template<typename... Args>
ListNodePointer System::Collections::Generic::List< R, disposer, allocator >::AddRange ( const R &  item)
inline

添加指定元素到 List<Of R> 的末尾, 并返回首元素链节点指针

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
template<typename... Args>
ListNodePointer System::Collections::Generic::List< R, disposer, allocator >::AddRange ( const R &  item,
const Args &...  args 
)
inline

添加指定元素到 List<Of R> 的末尾, 并返回首元素链节点指针

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
template<intptr_t N>
ListNodePointer System::Collections::Generic::List< R, disposer, allocator >::AddRange ( const R(&)  items[N])
inline

将指定集合的元素添加到 List<Of R> 的末尾, 并返回首元素链节点指针

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
ListNodePointer System::Collections::Generic::List< R, disposer, allocator >::AddRange ( const R  items[],
intptr_t  count 
)
inline

将指定集合的元素添加到 List<Of R> 的末尾, 并返回首元素链节点指针

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
Iterator System::Collections::Generic::List< R, disposer, allocator >::begin ( )
inline

Returns an iterator to the first element of the container. If the container is empty or nothing, the returned iterator will be equal to end()

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
template<typename disposer = IDisposable<R>>
void System::Collections::Generic::List< R, disposer, allocator >::Clear ( )
inline

List<Of R> 中移除所有元素

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
bool System::Collections::Generic::List< R, disposer, allocator >::Contains ( const R &  item) const
inline

确定某元素是否在 List<Of R> 中

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
template<class collection_t >
void System::Collections::Generic::List< R, disposer, allocator >::CopyTo ( collection_t &  obj) const
inline

List<Of R> 完全拷贝至指定集合处

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
Iterator System::Collections::Generic::List< R, disposer, allocator >::end ( )
inline

Returns an iterator to the element following the last element of the container. This element acts as a placeholder; attempting to access it results in undefined behavior.

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
R& System::Collections::Generic::List< R, disposer, allocator >::Get ( intptr_t  order) const
inline

获取 List<Of R> 中指定顺序(从0开始)的元素

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
intptr_t System::Collections::Generic::List< R, disposer, allocator >::GetLength ( ) const
inline

获取 List<Of R> 中实际包含的元素数

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
ListNodePointer System::Collections::Generic::List< R, disposer, allocator >::GetListNode ( intptr_t  order) const
inline

获取 List<Of R> 中指定顺序(从0开始)的元素的链节点指针

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
intptr_t System::Collections::Generic::List< R, disposer, allocator >::GetSafeLength ( ) const
inline

安全获取 List<Of R> 中实际包含的元素数

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
RLIB_FORCE_INLINE R* System::Collections::Generic::List< R, disposer, allocator >::GetType ( ) const
inline

Gets the Type of the current instance

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
intptr_t System::Collections::Generic::List< R, disposer, allocator >::IndexOf ( const R &  item,
typename IComparer< R >::EqualsDelegate  equals 
) const
inline

搜索指定的对象,并返回整个 List<Of R> 中第一个匹配项的从零开始的位置顺序

Returns
失败返回-1
template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
template<typename IComparer< R >::EqualsDelegate equals = IComparer<R>::Equals>
intptr_t System::Collections::Generic::List< R, disposer, allocator >::IndexOf ( const R &  item) const
inline

搜索指定的对象,并返回整个 List<Of R> 中第一个匹配项的从零开始的位置顺序

Returns
失败返回-1
template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
void System::Collections::Generic::List< R, disposer, allocator >::InitStorage ( intptr_t  cache_count)
inline

Creates back storage for caching. This function helps speed up the insertion of List that have a large number of elements, by avoiding the frequent memory allocation

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
ListNodePointer System::Collections::Generic::List< R, disposer, allocator >::Insert ( const R &  item,
const R &  itemToInsert,
typename IComparer< R >::EqualsDelegate  equals 
)
inline

将元素插入 List<Of R> 的指定元素前面, 否则插入末尾

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
template<typename IComparer< R >::EqualsDelegate equals = IComparer<R>::Equals>
ListNodePointer System::Collections::Generic::List< R, disposer, allocator >::Insert ( const R &  item,
const R &  itemToInsert 
)
inline

将元素插入 List<Of R> 的指定元素前面

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
ListNodePointer System::Collections::Generic::List< R, disposer, allocator >::Insert ( ListNodePointer  pNode,
const R &  item 
)
inline

将元素插入 List<Of R> 的指定元素前面

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
ListNodePointer System::Collections::Generic::List< R, disposer, allocator >::InsertAt ( intptr_t  order,
const R &  item 
)
inline

将元素插入 List<Of R> 的从零开始的指定位置顺序前面

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
ListNodePointer System::Collections::Generic::List< R, disposer, allocator >::InsertRange ( const R &  item,
const R *  itemsToInsert,
intptr_t  count 
)
inline

将集合中的某个元素插入 List<Of R> 的指定指定元素前面

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
bool System::Collections::Generic::List< R, disposer, allocator >::IsNull ( const R &  Node) const
inline

判断获取到的对象是否为空引用

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
intptr_t System::Collections::Generic::List< R, disposer, allocator >::LastIndexOf ( const R &  item,
typename IComparer< R >::EqualsDelegate  equals 
) const
inline

搜索指定的对象,并返回整个 List<Of R> 中最后一个匹配项的从零开始的位置顺序

Returns
失败返回-1
template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
template<typename IComparer< R >::EqualsDelegate equals = IComparer<R>::Equals>
intptr_t System::Collections::Generic::List< R, disposer, allocator >::LastIndexOf ( const R &  item) const
inline

搜索指定的对象,并返回整个 List<Of R> 中最后一个匹配项的从零开始的位置顺序

Returns
失败返回-1
template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
void System::Collections::Generic::List< R, disposer, allocator >::MoveFirst ( ListNodePointer  pNode)
inline

Moves the specified element to the first place

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
void System::Collections::Generic::List< R, disposer, allocator >::MoveLast ( ListNodePointer  pNode)
inline

Moves the specified element to the last place

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
void System::Collections::Generic::List< R, disposer, allocator >::MoveTo ( List< R > &  obj)
inline

List<Of R> 完全转移至另一 List<Of R> 处

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
List& System::Collections::Generic::List< R, disposer, allocator >::operator+= ( const R &  item)
inline

拓展运算符 添加对象

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
List<R>& System::Collections::Generic::List< R, disposer, allocator >::operator= ( const List< R > &  obj)
inline

赋值运算符 复制对象

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
R& System::Collections::Generic::List< R, disposer, allocator >::operator[] ( intptr_t  order) const
inline

获取 List<Of R> 中指定位置的元素

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
void System::Collections::Generic::List< R, disposer, allocator >::ReleaseStorage ( )
inline

destroy back storage

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
bool System::Collections::Generic::List< R, disposer, allocator >::Remove ( const R &  item,
typename IComparer< R >::EqualsDelegate  equals 
)
inline

List<Of R> 中移除特定对象的第一个匹配项

Returns
如果成功移除item, 则为true;否则为false.如果没有找到item, 也会返回false
template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
template<typename IComparer< R >::EqualsDelegate equals = IComparer<R>::Equals>
bool System::Collections::Generic::List< R, disposer, allocator >::Remove ( const R &  item)
inline

List<Of R> 中移除特定对象的第一个匹配项

Returns
如果成功移除item, 则为true;否则为false.如果没有找到item, 也会返回false
template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
void System::Collections::Generic::List< R, disposer, allocator >::Remove ( ListNodePointer  pNode)
inline

List<Of R> 中移除特定链节点

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
intptr_t System::Collections::Generic::List< R, disposer, allocator >::RemoveAll ( const R &  item)
inline

移除与特定对象相匹配的所有元素

Returns
List<Of R> 中移除的元素的数目
template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
bool System::Collections::Generic::List< R, disposer, allocator >::RemoveAt ( intptr_t  order)
inline

List<Of R> 中移除指定位置顺序的对象

Returns
如果成功移除item, 则为true
template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
bool System::Collections::Generic::List< R, disposer, allocator >::RemoveFirst ( )
inline

移除位于 List<Of R> 开头处的节点

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
bool System::Collections::Generic::List< R, disposer, allocator >::RemoveLast ( )
inline

移除位于 List<Of R> 结尾处的节点

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
void System::Collections::Generic::List< R, disposer, allocator >::Reverse ( intptr_t  order = 0,
intptr_t  count = 0 
)
inline

将指定范围中元素的顺序反转

Parameters
order从0开始的顺序位置
count交换次数, 默认0为全部
template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
System::Collections::Generic::List< R, disposer, allocator >::RLIB_PROPERTY_GET ( intptr_t  SafeLength,
GetSafeLength   
)

安全获取 List<Of R> 中实际包含的元素数

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
System::Collections::Generic::List< R, disposer, allocator >::RLIB_PROPERTY_GET ( const intptr_t  Length,
GetLength   
)

获取 List<Of R> 中实际包含的元素数

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
void System::Collections::Generic::List< R, disposer, allocator >::Sort ( typename IComparer< R >::Delegate  comparer = IComparer<R>::Compare,
intptr_t  begin = 0,
intptr_t  count = -1 
)
inline

List<Of R> 进行简单选择排序

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
template<typename comparer = IComparer<R>>
void System::Collections::Generic::List< R, disposer, allocator >::Sort ( intptr_t  begin = 0,
intptr_t  count = -1 
)
inline

List<Of R> 进行简单选择排序

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
Array<R>* System::Collections::Generic::List< R, disposer, allocator >::ToArray ( intptr_t  count = 0)
inline

List<Of R> 的值转换成 Array<Of R>

template<class R, class disposer = IDisposable<R>, class allocator = IO::IAllocator>
void System::Collections::Generic::List< R, disposer, allocator >::Unique ( )
inline

删除 List<Of R> 中所有重复的相邻元素


The documentation for this class was generated from the following file: