ActiveLib
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
active::container::List< T > Class Template Reference

#include <List.h>

Inheritance diagram for active::container::List< T >:
Inheritance graph
[legend]
Collaboration diagram for active::container::List< T >:
Collaboration graph
[legend]

Public Types

using value_t = std::unique_ptr<T>
 Stored type.
 
using base = std::list<value_t>
 Base container type.
 
using size_type = typename base::size_type
 Container size (index) type.
 
using iterator = typename base::iterator
 Container iterator type.
 
using const_iterator = typename base::const_iterator
 Container const iterator type.
 

Public Member Functions

 List ()
 
template<class Derived >
 List (const std::initializer_list< Derived > &items)
 
 List (const List &source)
 
 List (List &&source)
 
virtual ~List ()=default
 
auto operator= (const List &source)
 
auto operator= (List &&source)
 
void push_back (T *item)
 
void push_back (T &item)
 
void emplace_back (T &&item)
 
void emplace_back (const T &item)
 
void emplace_back (value_t &&item)
 
void emplace_back (value_t &item)
 
void push_front (T *item)
 
void emplace_front (T &&item)
 
void emplace_front (value_t &&item)
 
auto release (iterator &pos)
 

Detailed Description

template<class T>
requires utility::Clonable<T>
class active::container::List< T >

A specialisation class for a list of objects wrapped in unique_ptr

This allows list to store objects with polymorphic behaviour and object copying (object type must conform to Clonable). Keep in mind that the normal behaviour of the list is to take ownership of any objects stored in it (unless release is used)

NB: There is no requirement for container items to be non-null. It is entirely up the implementor if this rule should be adopted or enforced

Constructor & Destructor Documentation

◆ List() [1/4]

template<class T >
active::container::List< T >::List ( )
inline

Constructor

◆ List() [2/4]

template<class T >
template<class Derived >
active::container::List< T >::List ( const std::initializer_list< Derived > & items)
inlineexplicit

Constructor

Parameters
itemsThe items to insert into the list
Here is the call graph for this function:

◆ List() [3/4]

template<class T >
active::container::List< T >::List ( const List< T > & source)
inline

Copy constructor

Parameters
sourceThe object to copy

◆ List() [4/4]

template<class T >
active::container::List< T >::List ( List< T > && source)
inline

Move constructor

Parameters
sourceThe object to move

◆ ~List()

template<class T >
virtual active::container::List< T >::~List ( )
virtualdefault

Destructor

Member Function Documentation

◆ emplace_back() [1/4]

template<class T >
void active::container::List< T >::emplace_back ( const T & item)
inline

Push an item at the end of the list

Parameters
itemThe item to push

◆ emplace_back() [2/4]

template<class T >
void active::container::List< T >::emplace_back ( T && item)
inline

Push an item at the end of the list

Parameters
itemThe item to push
Here is the caller graph for this function:

◆ emplace_back() [3/4]

template<class T >
void active::container::List< T >::emplace_back ( value_t && item)
inline

Push an item at the end of the list

Parameters
itemThe item to push (already wrapped in unique_ptr)

◆ emplace_back() [4/4]

template<class T >
void active::container::List< T >::emplace_back ( value_t & item)
inline

Push an item at the end of the list

Parameters
itemThe item to push (already wrapped in unique_ptr)

◆ emplace_front() [1/2]

template<class T >
void active::container::List< T >::emplace_front ( T && item)
inline

Push an item at the front of the list

Parameters
itemThe item to push
Here is the caller graph for this function:

◆ emplace_front() [2/2]

template<class T >
void active::container::List< T >::emplace_front ( value_t && item)
inline

Push an item at the front of the list

Parameters
itemThe item to push (already wrapped in unique_ptr)

◆ operator=() [1/2]

template<class T >
auto active::container::List< T >::operator= ( const List< T > & source)
inline

Assignment operator

Parameters
sourceThe object to copy
Returns
A reference to this

◆ operator=() [2/2]

template<class T >
auto active::container::List< T >::operator= ( List< T > && source)
inline

Assignment operator

Parameters
sourceThe object to move
Returns
A reference to this

◆ push_back() [1/2]

template<class T >
void active::container::List< T >::push_back ( T & item)
inline

Push an item at the end of the list

Parameters
itemThe item to push (ownership passes to this list)

◆ push_back() [2/2]

template<class T >
void active::container::List< T >::push_back ( T * item)
inline

Push an item at the end of the list

Parameters
itemThe item to push (ownership passes to this list)

◆ push_front()

template<class T >
void active::container::List< T >::push_front ( T * item)
inline

Push an item at the end of the list

Parameters
itemThe item to push (ownership passes to this list)

◆ release()

template<class T >
auto active::container::List< T >::release ( iterator & pos)
inline

Release the pointer held by the specified item and erase

Parameters
posAn iterator pointing to the item to be removed
Returns
An iterator at the next value
Here is the caller graph for this function:

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