cppcore
A small, portable C++ core library
Loading...
Searching...
No Matches
cppcore::TList< T, TAlloc > Class Template Reference

This template class implements a simple double linked list container. More...

#include <TList.h>

Classes

class  Iterator
 Access implementation class. More...

Public Member Functions

 TList () noexcept=default
 The class default constructor.
 TList (const TList< T, TAlloc > &rhs)
 The class copy constructor.
 ~TList ()
 The class destructor.
void copyFrom (const TList< T, TAlloc > &rOther)
 Copy the data from a given instance.
Iterator addFront (const T &item)
 Adds a new item at the front of the list.
Iterator addBack (const T &item)
 Adds a new item at the back of the list.
void removeFront ()
 The first item will be removed.
void removeBack ()
 The hast item will be removed.
T & front () const
 Returns the first item.
T & back () const
 Returns the last item.
size_t size () const
 The number of stored items will be returned.
bool isEmpty () const
 Returns true, if the list is empty.
void clear ()
 The list will be cleared.
Iterator begin () const
 Returns the iterator showing to the first entry.
Iterator end () const
 Returns the iterator showing to the last entry.
bool operator== (const TList< T, TAlloc > &rOther) const
 Compare operator.
TList< T, TAlloc > & operator= (const TList< T, TAlloc > &rOther)
 Assignment operator.

Detailed Description

template<class T, class TAlloc = TDefaultAllocator<T>>
class cppcore::TList< T, TAlloc >

This template class implements a simple double linked list container.

Definition at line 37 of file TList.h.

Constructor & Destructor Documentation

◆ TList() [1/2]

template<class T, class TAlloc = TDefaultAllocator<T>>
cppcore::TList< T, TAlloc >::TList ( )
defaultnoexcept

◆ TList() [2/2]

template<class T, class TAlloc>
cppcore::TList< T, TAlloc >::TList ( const TList< T, TAlloc > & rhs)
inline

The class copy constructor.

Parameters
rhsInstance to copy from.

Definition at line 165 of file TList.h.

References copyFrom(), and TList().

◆ ~TList()

template<class T, class TAlloc>
cppcore::TList< T, TAlloc >::~TList ( )
inline

The class destructor.

Definition at line 173 of file TList.h.

References clear().

Member Function Documentation

◆ addBack()

template<class T, class TAlloc>
TList< T, TAlloc >::Iterator cppcore::TList< T, TAlloc >::addBack ( const T & item)
inline

Adds a new item at the back of the list.

Parameters
itemInstance to add
Returns
The new iterator.

Definition at line 220 of file TList.h.

Referenced by operator=(), and TList().

◆ addFront()

template<class T, class TAlloc>
TList< T, TAlloc >::Iterator cppcore::TList< T, TAlloc >::addFront ( const T & item)
inline

Adds a new item at the front of the list.

Parameters
itemInstance to add
Returns
The new iterator.

Definition at line 204 of file TList.h.

Referenced by TList().

◆ back()

template<class T, class TAlloc>
T & cppcore::TList< T, TAlloc >::back ( ) const
inline

Returns the last item.

Returns
The last item.

Definition at line 264 of file TList.h.

Referenced by TList().

◆ begin()

template<class T, class TAlloc>
TList< T, TAlloc >::Iterator cppcore::TList< T, TAlloc >::begin ( ) const
inline

Returns the iterator showing to the first entry.

Returns
An iterator referencing to the begin of the list.

Definition at line 299 of file TList.h.

References end(), and isEmpty().

Referenced by copyFrom(), operator=(), operator==(), and TList().

◆ clear()

template<class T, class TAlloc>
void cppcore::TList< T, TAlloc >::clear ( )
inline

The list will be cleared.

Definition at line 281 of file TList.h.

References isEmpty().

Referenced by copyFrom(), operator=(), TList(), and ~TList().

◆ copyFrom()

template<class T, class TAlloc>
void cppcore::TList< T, TAlloc >::copyFrom ( const TList< T, TAlloc > & rOther)
inline

Copy the data from a given instance.

Parameters
rOtherInstance to copy from.

Definition at line 178 of file TList.h.

References begin(), clear(), end(), and TList().

Referenced by TList(), and TList().

◆ end()

template<class T, class TAlloc>
TList< T, TAlloc >::Iterator cppcore::TList< T, TAlloc >::end ( ) const
inline

Returns the iterator showing to the last entry.

Returns
An iterator referencing to the end of the list.

Definition at line 308 of file TList.h.

Referenced by begin(), copyFrom(), operator=(), operator==(), and TList().

◆ front()

template<class T, class TAlloc>
T & cppcore::TList< T, TAlloc >::front ( ) const
inline

Returns the first item.

Returns
The first item.

Definition at line 257 of file TList.h.

Referenced by TList().

◆ isEmpty()

template<class T, class TAlloc>
bool cppcore::TList< T, TAlloc >::isEmpty ( ) const
inline

Returns true, if the list is empty.

Returns
true, if no items are store, false if items are there.

Definition at line 276 of file TList.h.

Referenced by begin(), clear(), and TList().

◆ operator=()

template<class T, class TAlloc>
TList< T, TAlloc > & cppcore::TList< T, TAlloc >::operator= ( const TList< T, TAlloc > & rOther)
inline

Assignment operator.

Definition at line 329 of file TList.h.

References addBack(), begin(), clear(), end(), and TList().

◆ operator==()

template<class T, class TAlloc>
bool cppcore::TList< T, TAlloc >::operator== ( const TList< T, TAlloc > & rOther) const
inline

Compare operator.

Definition at line 313 of file TList.h.

References begin(), end(), and TList().

◆ removeBack()

template<class T, class TAlloc>
void cppcore::TList< T, TAlloc >::removeBack ( )
inline

The hast item will be removed.

Definition at line 248 of file TList.h.

Referenced by TList().

◆ removeFront()

template<class T, class TAlloc>
void cppcore::TList< T, TAlloc >::removeFront ( )
inline

The first item will be removed.

Definition at line 236 of file TList.h.

Referenced by TList().

◆ size()

template<class T, class TAlloc>
size_t cppcore::TList< T, TAlloc >::size ( ) const
inline

The number of stored items will be returned.

Returns
The number of stored items.

Definition at line 271 of file TList.h.

Referenced by TList().


The documentation for this class was generated from the following file:
  • include/cppcore/Container/TList.h