CoreComponents 3.0.0
A Modern C++ Toolkit
|
Single-linked list data container. More...
#include <cc/AppendList>
Public Types | |
using | Item = T |
Item type. | |
using | Transaction = AppendListTransaction<T> |
Transaction type | |
using | const_iterator = AppendListIterator<T> |
Readonly value iterator. | |
using | iterator = const_iterator |
Readonly value iterator. | |
Public Member Functions | |
AppendList ()=default | |
Create an empty list. | |
AppendList (std::initializer_list< T > items) | |
Construct with initial items. | |
AppendList (const AppendList &other) | |
Create a deep copy of other. | |
AppendList (AppendList &&other) | |
Take over other. | |
AppendList & | operator= (AppendList &&other) |
Take over other. | |
AppendList & | operator= (const AppendList &other) |
Create a deep copy of other. | |
~AppendList () | |
Destroy the list. | |
template<class... Args> | |
void | emplaceBack (Args... args) |
Insert a new last item. | |
void | pushBack (const T &item) |
Insert item as a new last item. | |
void | append (const T &item) |
Insert item as a new last item. | |
const T & | first () const |
Get constant reference to first item. | |
const T & | last () const |
Get constant reference to last item. | |
Transaction | transaction () |
Begin a transaction. | |
const_iterator | begin () const |
Return readonly iterator pointing to the first item (if any) | |
const_iterator | end () const |
Return readonly iterator pointing behind the last item | |
bool | isEmpty () const |
Tell if empty | |
long | count () const |
Get number of items | |
long | size () const |
Get number of items | |
operator bool () const | |
Check if this list is non-empty. | |
long | operator+ () const |
Get number of items | |
void | deplete () |
Remove all items. | |
Single-linked list data container.
T | Item type |
AppendList is an as simple as it gets list data structure based on a single-linked list. The AppendList out-performs the List for short lists (smaller than 10 items) in both speed and memory consumption. Construction of an empty AppendList does not imply a memory allocation.
using Item = T |
Item type.
using Transaction = AppendListTransaction<T> |
Transaction type
using const_iterator = AppendListIterator<T> |
Readonly value iterator.
using iterator = const_iterator |
Readonly value iterator.
|
default |
Create an empty list.
AppendList | ( | std::initializer_list< T > | items | ) |
Construct with initial items.
AppendList | ( | const AppendList< T > & | other | ) |
Create a deep copy of other.
AppendList | ( | AppendList< T > && | other | ) |
Take over other.
~AppendList | ( | ) |
Destroy the list.
AppendList & operator= | ( | AppendList< T > && | other | ) |
Take over other.
AppendList & operator= | ( | const AppendList< T > & | other | ) |
Create a deep copy of other.
void emplaceBack | ( | Args... | args | ) |
Insert a new last item.
args | construction arguments |
void pushBack | ( | const T & | item | ) |
Insert item as a new last item.
void append | ( | const T & | item | ) |
Insert item as a new last item.
const T & first | ( | ) | const |
Get constant reference to first item.
const T & last | ( | ) | const |
Get constant reference to last item.
Transaction transaction | ( | ) |
Begin a transaction.
const_iterator begin | ( | ) | const |
Return readonly iterator pointing to the first item (if any)
const_iterator end | ( | ) | const |
Return readonly iterator pointing behind the last item
bool isEmpty | ( | ) | const |
Tell if empty
long count | ( | ) | const |
Get number of items
long size | ( | ) | const |
Get number of items
|
explicit |
Check if this list is non-empty.
long operator+ | ( | ) | const |
Get number of items
void deplete | ( | ) |
Remove all items.