StormByte 3.0.0
C++26 foundation of the StormByte suite
Loading...
Searching...
No Matches
StormByte::Safe::List< T > Class Template Referencefinal

Doubly linked list stored on Base's heap. More...

#include <StormByte/safe/list.hxx>

Classes

class  BasicIterator
 Bidirectional cursor over Base-owned list nodes. More...
class  node_type
 Owning handle to one extracted Base node. More...

Public Types

using value_type = T
 Element type.
using size_type = Size
 Element count. Size, not std::size_t.
using difference_type = std::ptrdiff_t
 Iterator distance type.
using reference = T&
 Mutable element reference.
using const_reference = const T&
 Read-only element reference.
using iterator = BasicIterator<false>
 Mutable iterator.
using const_iterator = BasicIterator<true>
 Read-only iterator.
using reverse_iterator = std::reverse_iterator<iterator>
 Mutable reverse iterator.
using const_reverse_iterator = std::reverse_iterator<const_iterator>
 Read-only reverse iterator.

Public Member Functions

 List () noexcept
 Construct an empty list.
 List (size_type count)
 Construct count value-initialized elements.
 List (size_type count, const T &value)
 Construct count copies of value.
 List (const List &other)
 Copy every node into new Base blocks.
 List (List &&other) noexcept
 Take the chain.
STORMBYTE_FORCE_INLINE List (const std::list< T > &other)
 Copy a caller-owned STL list.
STORMBYTE_FORCE_INLINE List (std::list< T > &&other)
 Move elements from a caller-owned STL list and leave it empty.
template<std::ranges::input_range R>
requires std::convertible_to<std::ranges::range_reference_t<R>, T>
STORMBYTE_FORCE_INLINE List (std::from_range_t, R &&range)
 Copy the elements of range.
 List (std::initializer_list< T > values)
 Insert every element of an initializer list.
 ~List () noexcept
 Destroy every node through Base.
List & operator= (const List &other)
 Copy-assign.
List & operator= (List &&other) noexcept
 Move-assign.
List & operator= (std::initializer_list< T > values)
 Replace the contents with an initializer list.
void assign (size_type count, const T &value)
 Replace the contents with count copies of value.
void assign (std::initializer_list< T > values)
 Replace the contents with an initializer list.
template<std::ranges::input_range R>
requires std::convertible_to<std::ranges::range_reference_t<R>, T>
STORMBYTE_FORCE_INLINE void assign_range (R &&range)
 Replace the contents with range.
T & front () noexcept
 Return the first element.
const T & front () const noexcept
 Return the first element.
T & back () noexcept
 Return the last element.
const T & back () const noexcept
 Return the last element.
iterator begin () noexcept
 Return the first element.
iterator end () noexcept
 Return the past-the-end iterator.
const_iterator begin () const noexcept
 Return the first element.
const_iterator end () const noexcept
 Return the past-the-end iterator.
const_iterator cbegin () const noexcept
 Return the first element.
const_iterator cend () const noexcept
 Return the past-the-end iterator.
reverse_iterator rbegin () noexcept
 Return a reverse iterator to the last element.
reverse_iterator rend () noexcept
 Return the reverse past-the-end iterator.
const_reverse_iterator rbegin () const noexcept
 Return a reverse iterator to the last element.
const_reverse_iterator rend () const noexcept
 Return the reverse past-the-end iterator.
const_reverse_iterator crbegin () const noexcept
 Return a reverse iterator to the last element.
const_reverse_iterator crend () const noexcept
 Return the reverse past-the-end iterator.
bool empty () const noexcept
 Test whether the list holds no elements.
size_type size () const noexcept
 Return the element count.
size_type max_size () const noexcept
 Return the maximum element count this list can report.
void clear () noexcept
 Destroy every element.
iterator insert (const_iterator position, const T &value)
 Insert a copy of value before position.
iterator insert (const_iterator position, T &&value)
 Insert a moved value before position.
iterator insert (const_iterator position, size_type count, const T &value)
 Insert count copies of value before position.
iterator insert (const_iterator position, std::initializer_list< T > values)
 Insert every element of an initializer list before position.
template<std::ranges::input_range R>
requires std::convertible_to<std::ranges::range_reference_t<R>, T>
STORMBYTE_FORCE_INLINE iterator insert_range (const_iterator position, R &&range)
 Insert every element of range before position.
template<class... Args>
iterator emplace (const_iterator position, Args &&... args)
 Construct an element in place before position.
iterator erase (const_iterator position)
 Erase the element at position.
iterator erase (const_iterator first, const_iterator last)
 Erase the half-open range [first, last).
void push_front (const T &value)
 Copy value to the front.
void push_front (T &&value)
 Move value to the front.
template<class... Args>
T & emplace_front (Args &&... args)
 Construct an element at the front.
void pop_front () noexcept
 Destroy the first element.
void push_back (const T &value)
 Copy value to the back.
void push_back (T &&value)
 Move value to the back.
template<class... Args>
T & emplace_back (Args &&... args)
 Construct an element at the back.
void pop_back () noexcept
 Destroy the last element.
void resize (size_type count)
 Grow or shrink to count.
void resize (size_type count, const T &value)
 Grow or shrink to count.
void swap (List &other) noexcept
 Exchange chains.
void splice (const_iterator position, List &other) noexcept
 Relink every node of other before position.
void splice (const_iterator position, List &other, const_iterator source) noexcept
 Relink the node at source before position.
void splice (const_iterator position, List &other, const_iterator first, const_iterator last) noexcept
 Relink [first, last) before position.
node_type extract (const_iterator position)
 Unlink the element at position.
iterator insert (const_iterator position, node_type &&node)
 Link an extracted node before position.
void merge (List &other)
 Move the ordered nodes of other into this ordered list.
template<class Compare>
void merge (List &other, Compare compare)
 Move the ordered nodes of other into this ordered list.
size_type remove (const T &value)
 Erase every element equal to value.
template<class Predicate>
size_type remove_if (Predicate predicate)
 Erase every element for which predicate is true.
void reverse () noexcept
 Reverse the chain.
size_type unique ()
 Erase consecutive duplicates.
template<class Predicate>
size_type unique (Predicate predicate)
 Erase consecutive elements for which predicate is true.
void sort ()
 Sort the chain.
template<class Compare>
void sort (Compare compare)
 Sort the chain.
bool operator== (const List &other) const
 Compare elements in order.
STORMBYTE_FORCE_INLINE std::strong_ordering operator<=> (const List &other) const
 Order the lists lexicographically.
STORMBYTE_FORCE_INLINE operator std::list< T > () const
 Copy the elements into caller-owned STL storage.

Detailed Description

template<Type::SafeValue T>
class StormByte::Safe::List< T >

Doubly linked list stored on Base's heap.

Template Parameters
TSafe value type.

Nodes are allocated with Heap::Allocate. There is no allocator. The sentinel lives in the list object, so an empty list does not construct a T. Iterators are bidirectional and point at Base nodes. node_type owns a Base node. It is not std::list::node_type. extract, splice and merge relink that node. They do not copy it. A conversion to or from std::list copies the elements.

Member Typedef Documentation

◆ const_iterator

template<Type::SafeValue T>
using StormByte::Safe::List< T >::const_iterator = BasicIterator<true>

Read-only iterator.

◆ const_reference

template<Type::SafeValue T>
using StormByte::Safe::List< T >::const_reference = const T&

Read-only element reference.

◆ const_reverse_iterator

template<Type::SafeValue T>
using StormByte::Safe::List< T >::const_reverse_iterator = std::reverse_iterator<const_iterator>

Read-only reverse iterator.

◆ difference_type

template<Type::SafeValue T>
using StormByte::Safe::List< T >::difference_type = std::ptrdiff_t

Iterator distance type.

◆ iterator

template<Type::SafeValue T>
using StormByte::Safe::List< T >::iterator = BasicIterator<false>

Mutable iterator.

◆ reference

template<Type::SafeValue T>
using StormByte::Safe::List< T >::reference = T&

Mutable element reference.

◆ reverse_iterator

template<Type::SafeValue T>
using StormByte::Safe::List< T >::reverse_iterator = std::reverse_iterator<iterator>

Mutable reverse iterator.

◆ size_type

template<Type::SafeValue T>
using StormByte::Safe::List< T >::size_type = Size

Element count. Size, not std::size_t.

◆ value_type

template<Type::SafeValue T>
using StormByte::Safe::List< T >::value_type = T

Element type.

Constructor & Destructor Documentation

◆ List() [1/9]

template<Type::SafeValue T>
StormByte::Safe::List< T >::List ( )
noexcept

Construct an empty list.

◆ List() [2/9]

template<Type::SafeValue T>
StormByte::Safe::List< T >::List ( size_type count)
explicit

Construct count value-initialized elements.

Parameters
countElement count.
Exceptions
AllocationErrorA node could not be allocated.

◆ List() [3/9]

template<Type::SafeValue T>
StormByte::Safe::List< T >::List ( size_type count,
const T & value )

Construct count copies of value.

Parameters
countElement count.
valueElement to copy.
Exceptions
AllocationErrorA node could not be allocated.

◆ List() [4/9]

template<Type::SafeValue T>
StormByte::Safe::List< T >::List ( const List< T > & other)

Copy every node into new Base blocks.

Parameters
otherSource.
Exceptions
AllocationErrorA node could not be allocated.

◆ List() [5/9]

template<Type::SafeValue T>
StormByte::Safe::List< T >::List ( List< T > && other)
noexcept

Take the chain.

other is left empty.

Parameters
otherSource.

◆ List() [6/9]

template<Type::SafeValue T>
STORMBYTE_FORCE_INLINE StormByte::Safe::List< T >::List ( const std::list< T > & other)
inlineexplicit

Copy a caller-owned STL list.

Its state is unchanged.

Parameters
otherSource.
Exceptions
AllocationErrorA node could not be allocated.

◆ List() [7/9]

template<Type::SafeValue T>
STORMBYTE_FORCE_INLINE StormByte::Safe::List< T >::List ( std::list< T > && other)
inlineexplicit

Move elements from a caller-owned STL list and leave it empty.

Parameters
otherSource. Cleared before this function returns.
Exceptions
AllocationErrorA node could not be allocated.

◆ List() [8/9]

template<Type::SafeValue T>
template<std::ranges::input_range R>
requires std::convertible_to<std::ranges::range_reference_t<R>, T>
STORMBYTE_FORCE_INLINE StormByte::Safe::List< T >::List ( std::from_range_t ,
R && range )
inlineexplicit

Copy the elements of range.

Template Parameters
RInput range of T.
Parameters
rangeSource. Instantiated in the caller.
Exceptions
AllocationErrorA node could not be allocated.

◆ List() [9/9]

template<Type::SafeValue T>
StormByte::Safe::List< T >::List ( std::initializer_list< T > values)

Insert every element of an initializer list.

Parameters
valuesElements.
Exceptions
AllocationErrorA node could not be allocated.

◆ ~List()

template<Type::SafeValue T>
StormByte::Safe::List< T >::~List ( )
noexcept

Destroy every node through Base.

Member Function Documentation

◆ assign() [1/2]

template<Type::SafeValue T>
void StormByte::Safe::List< T >::assign ( size_type count,
const T & value )

Replace the contents with count copies of value.

Parameters
countElement count.
valueElement to copy.
Exceptions
AllocationErrorA node could not be allocated.

◆ assign() [2/2]

template<Type::SafeValue T>
void StormByte::Safe::List< T >::assign ( std::initializer_list< T > values)

Replace the contents with an initializer list.

Parameters
valuesElements.
Exceptions
AllocationErrorA node could not be allocated.

◆ assign_range()

template<Type::SafeValue T>
template<std::ranges::input_range R>
requires std::convertible_to<std::ranges::range_reference_t<R>, T>
STORMBYTE_FORCE_INLINE void StormByte::Safe::List< T >::assign_range ( R && range)
inline

Replace the contents with range.

Template Parameters
RInput range of T.
Parameters
rangeSource. Instantiated in the caller.
Exceptions
AllocationErrorA node could not be allocated.

◆ back() [1/2]

template<Type::SafeValue T>
const T & StormByte::Safe::List< T >::back ( ) const
inlinenoexcept

Return the last element.

Returns
Last element. The list is not empty.

◆ back() [2/2]

template<Type::SafeValue T>
T & StormByte::Safe::List< T >::back ( )
inlinenoexcept

Return the last element.

Returns
Last element. The list is not empty.

◆ begin() [1/2]

template<Type::SafeValue T>
const_iterator StormByte::Safe::List< T >::begin ( ) const
inlinenoexcept

Return the first element.

Returns
Read-only iterator, or end when empty.

◆ begin() [2/2]

template<Type::SafeValue T>
iterator StormByte::Safe::List< T >::begin ( )
inlinenoexcept

Return the first element.

Returns
Mutable iterator, or end when empty.

◆ cbegin()

template<Type::SafeValue T>
const_iterator StormByte::Safe::List< T >::cbegin ( ) const
inlinenoexcept

Return the first element.

Returns
Read-only iterator.

◆ cend()

template<Type::SafeValue T>
const_iterator StormByte::Safe::List< T >::cend ( ) const
inlinenoexcept

Return the past-the-end iterator.

Returns
Read-only iterator.

◆ clear()

template<Type::SafeValue T>
void StormByte::Safe::List< T >::clear ( )
noexcept

Destroy every element.

The sentinel stays.

◆ crbegin()

template<Type::SafeValue T>
const_reverse_iterator StormByte::Safe::List< T >::crbegin ( ) const
inlinenoexcept

Return a reverse iterator to the last element.

Returns
Read-only reverse iterator.

◆ crend()

template<Type::SafeValue T>
const_reverse_iterator StormByte::Safe::List< T >::crend ( ) const
inlinenoexcept

Return the reverse past-the-end iterator.

Returns
Read-only reverse iterator.

◆ emplace()

template<Type::SafeValue T>
template<class... Args>
iterator StormByte::Safe::List< T >::emplace ( const_iterator position,
Args &&... args )

Construct an element in place before position.

Template Parameters
ArgsConstructor argument types.
Parameters
positionInsertion point.
argsArguments forwarded to T.
Returns
Iterator to the inserted element.
Exceptions
AllocationErrorA node could not be allocated.

◆ emplace_back()

template<Type::SafeValue T>
template<class... Args>
T & StormByte::Safe::List< T >::emplace_back ( Args &&... args)

Construct an element at the back.

Template Parameters
ArgsConstructor argument types.
Parameters
argsArguments forwarded to T.
Returns
Inserted element.
Exceptions
AllocationErrorA node could not be allocated.

◆ emplace_front()

template<Type::SafeValue T>
template<class... Args>
T & StormByte::Safe::List< T >::emplace_front ( Args &&... args)

Construct an element at the front.

Template Parameters
ArgsConstructor argument types.
Parameters
argsArguments forwarded to T.
Returns
Inserted element.
Exceptions
AllocationErrorA node could not be allocated.

◆ empty()

template<Type::SafeValue T>
bool StormByte::Safe::List< T >::empty ( ) const
inlinenoexcept

Test whether the list holds no elements.

Returns
Whether the list is empty.

◆ end() [1/2]

template<Type::SafeValue T>
const_iterator StormByte::Safe::List< T >::end ( ) const
inlinenoexcept

Return the past-the-end iterator.

Returns
Read-only iterator.

◆ end() [2/2]

template<Type::SafeValue T>
iterator StormByte::Safe::List< T >::end ( )
inlinenoexcept

Return the past-the-end iterator.

Returns
Mutable iterator.

◆ erase() [1/2]

template<Type::SafeValue T>
iterator StormByte::Safe::List< T >::erase ( const_iterator first,
const_iterator last )

Erase the half-open range [first, last).

Parameters
firstFirst element to erase.
lastOne past the last element to erase.
Returns
Iterator to last.

◆ erase() [2/2]

template<Type::SafeValue T>
iterator StormByte::Safe::List< T >::erase ( const_iterator position)

Erase the element at position.

Parameters
positionIterator to an element. Not end.
Returns
Iterator to the following element.

◆ extract()

template<Type::SafeValue T>
node_type StormByte::Safe::List< T >::extract ( const_iterator position)

Unlink the element at position.

The node is not copied.

Parameters
positionIterator to an element. Not end.
Returns
Owning handle.

◆ front() [1/2]

template<Type::SafeValue T>
const T & StormByte::Safe::List< T >::front ( ) const
inlinenoexcept

Return the first element.

Returns
First element. The list is not empty.

◆ front() [2/2]

template<Type::SafeValue T>
T & StormByte::Safe::List< T >::front ( )
inlinenoexcept

Return the first element.

Returns
First element. The list is not empty.

◆ insert() [1/5]

template<Type::SafeValue T>
iterator StormByte::Safe::List< T >::insert ( const_iterator position,
const T & value )

Insert a copy of value before position.

Parameters
positionInsertion point.
valueElement.
Returns
Iterator to the inserted element.
Exceptions
AllocationErrorA node could not be allocated.

◆ insert() [2/5]

template<Type::SafeValue T>
iterator StormByte::Safe::List< T >::insert ( const_iterator position,
node_type && node )

Link an extracted node before position.

Parameters
positionInsertion point.
nodeHandle. Left empty.
Returns
Iterator to the linked element, or position when node is empty.

◆ insert() [3/5]

template<Type::SafeValue T>
iterator StormByte::Safe::List< T >::insert ( const_iterator position,
size_type count,
const T & value )

Insert count copies of value before position.

Parameters
positionInsertion point.
countCopy count.
valueElement.
Returns
Iterator to the first inserted element, or position when count is zero.
Exceptions
AllocationErrorA node could not be allocated.

◆ insert() [4/5]

template<Type::SafeValue T>
iterator StormByte::Safe::List< T >::insert ( const_iterator position,
std::initializer_list< T > values )

Insert every element of an initializer list before position.

Parameters
positionInsertion point.
valuesElements.
Returns
Iterator to the first inserted element, or position when values is empty.
Exceptions
AllocationErrorA node could not be allocated.

◆ insert() [5/5]

template<Type::SafeValue T>
iterator StormByte::Safe::List< T >::insert ( const_iterator position,
T && value )

Insert a moved value before position.

Parameters
positionInsertion point.
valueElement.
Returns
Iterator to the inserted element.
Exceptions
AllocationErrorA node could not be allocated.

◆ insert_range()

template<Type::SafeValue T>
template<std::ranges::input_range R>
requires std::convertible_to<std::ranges::range_reference_t<R>, T>
STORMBYTE_FORCE_INLINE iterator StormByte::Safe::List< T >::insert_range ( const_iterator position,
R && range )
inline

Insert every element of range before position.

Template Parameters
RInput range of T.
Parameters
positionInsertion point.
rangeSource. Instantiated in the caller.
Returns
Iterator to the first inserted element, or position when range is empty.
Exceptions
AllocationErrorA node could not be allocated.

◆ max_size()

template<Type::SafeValue T>
size_type StormByte::Safe::List< T >::max_size ( ) const
inlinenoexcept

Return the maximum element count this list can report.

Returns
Maximum count.

◆ merge() [1/2]

template<Type::SafeValue T>
void StormByte::Safe::List< T >::merge ( List< T > & other)

Move the ordered nodes of other into this ordered list.

Parameters
otherSource. Left with the nodes that were not taken. Both lists are ordered by operator<.

◆ merge() [2/2]

template<Type::SafeValue T>
template<class Compare>
void StormByte::Safe::List< T >::merge ( List< T > & other,
Compare compare )

Move the ordered nodes of other into this ordered list.

Template Parameters
CompareStrict weak ordering.
Parameters
otherSource.
compareElement ordering.

◆ operator std::list< T >()

template<Type::SafeValue T>
STORMBYTE_FORCE_INLINE StormByte::Safe::List< T >::operator std::list< T > ( ) const
inlineexplicit

Copy the elements into caller-owned STL storage.

Returns
A std::list owned by the caller.

◆ operator<=>()

template<Type::SafeValue T>
STORMBYTE_FORCE_INLINE std::strong_ordering StormByte::Safe::List< T >::operator<=> ( const List< T > & other) const

Order the lists lexicographically.

Parameters
otherList to compare.
Returns
Three-way comparison of the elements.

◆ operator=() [1/3]

template<Type::SafeValue T>
List & StormByte::Safe::List< T >::operator= ( const List< T > & other)

Copy-assign.

The previous chain is released only after the copy exists.

Parameters
otherSource.
Returns
This list.
Exceptions
AllocationErrorA node could not be allocated.

◆ operator=() [2/3]

template<Type::SafeValue T>
List & StormByte::Safe::List< T >::operator= ( List< T > && other)
noexcept

Move-assign.

other is left empty.

Parameters
otherSource.
Returns
This list.

◆ operator=() [3/3]

template<Type::SafeValue T>
List & StormByte::Safe::List< T >::operator= ( std::initializer_list< T > values)

Replace the contents with an initializer list.

Parameters
valuesElements.
Returns
This list.
Exceptions
AllocationErrorA node could not be allocated.

◆ operator==()

template<Type::SafeValue T>
bool StormByte::Safe::List< T >::operator== ( const List< T > & other) const

Compare elements in order.

Parameters
otherList to compare.
Returns
Whether both lists hold the same elements in the same order.

◆ pop_back()

template<Type::SafeValue T>
void StormByte::Safe::List< T >::pop_back ( )
noexcept

Destroy the last element.

The list is not empty.

◆ pop_front()

template<Type::SafeValue T>
void StormByte::Safe::List< T >::pop_front ( )
noexcept

Destroy the first element.

The list is not empty.

◆ push_back() [1/2]

template<Type::SafeValue T>
void StormByte::Safe::List< T >::push_back ( const T & value)

Copy value to the back.

Parameters
valueElement.
Exceptions
AllocationErrorA node could not be allocated.

◆ push_back() [2/2]

template<Type::SafeValue T>
void StormByte::Safe::List< T >::push_back ( T && value)

Move value to the back.

Parameters
valueElement.
Exceptions
AllocationErrorA node could not be allocated.

◆ push_front() [1/2]

template<Type::SafeValue T>
void StormByte::Safe::List< T >::push_front ( const T & value)

Copy value to the front.

Parameters
valueElement.
Exceptions
AllocationErrorA node could not be allocated.

◆ push_front() [2/2]

template<Type::SafeValue T>
void StormByte::Safe::List< T >::push_front ( T && value)

Move value to the front.

Parameters
valueElement.
Exceptions
AllocationErrorA node could not be allocated.

◆ rbegin() [1/2]

template<Type::SafeValue T>
const_reverse_iterator StormByte::Safe::List< T >::rbegin ( ) const
inlinenoexcept

Return a reverse iterator to the last element.

Returns
Read-only reverse iterator.

◆ rbegin() [2/2]

template<Type::SafeValue T>
reverse_iterator StormByte::Safe::List< T >::rbegin ( )
inlinenoexcept

Return a reverse iterator to the last element.

Returns
Mutable reverse iterator.

◆ remove()

template<Type::SafeValue T>
size_type StormByte::Safe::List< T >::remove ( const T & value)

Erase every element equal to value.

Parameters
valueElement to erase.
Returns
Number of erased elements.

◆ remove_if()

template<Type::SafeValue T>
template<class Predicate>
size_type StormByte::Safe::List< T >::remove_if ( Predicate predicate)

Erase every element for which predicate is true.

Template Parameters
PredicateUnary predicate.
Parameters
predicateErase condition.
Returns
Number of erased elements.

◆ rend() [1/2]

template<Type::SafeValue T>
const_reverse_iterator StormByte::Safe::List< T >::rend ( ) const
inlinenoexcept

Return the reverse past-the-end iterator.

Returns
Read-only reverse iterator.

◆ rend() [2/2]

template<Type::SafeValue T>
reverse_iterator StormByte::Safe::List< T >::rend ( )
inlinenoexcept

Return the reverse past-the-end iterator.

Returns
Mutable reverse iterator.

◆ resize() [1/2]

template<Type::SafeValue T>
void StormByte::Safe::List< T >::resize ( size_type count)

Grow or shrink to count.

New elements are value-initialized.

Parameters
countNew element count.
Exceptions
AllocationErrorA node could not be allocated.

◆ resize() [2/2]

template<Type::SafeValue T>
void StormByte::Safe::List< T >::resize ( size_type count,
const T & value )

Grow or shrink to count.

New elements are copies of value.

Parameters
countNew element count.
valueElement to copy.
Exceptions
AllocationErrorA node could not be allocated.

◆ reverse()

template<Type::SafeValue T>
void StormByte::Safe::List< T >::reverse ( )
noexcept

Reverse the chain.

Does not allocate.

◆ size()

template<Type::SafeValue T>
size_type StormByte::Safe::List< T >::size ( ) const
inlinenoexcept

Return the element count.

Returns
Element count.

◆ sort() [1/2]

template<Type::SafeValue T>
void StormByte::Safe::List< T >::sort ( )

Sort the chain.

Ordering is operator<. Nodes are relinked, not copied.

◆ sort() [2/2]

template<Type::SafeValue T>
template<class Compare>
void StormByte::Safe::List< T >::sort ( Compare compare)

Sort the chain.

Nodes are relinked, not copied.

Template Parameters
CompareStrict weak ordering.
Parameters
compareElement ordering.

◆ splice() [1/3]

template<Type::SafeValue T>
void StormByte::Safe::List< T >::splice ( const_iterator position,
List< T > & other )
noexcept

Relink every node of other before position.

other is left empty.

Parameters
positionInsertion point.
otherSource. Not this list.

◆ splice() [2/3]

template<Type::SafeValue T>
void StormByte::Safe::List< T >::splice ( const_iterator position,
List< T > & other,
const_iterator first,
const_iterator last )
noexcept

Relink [first, last) before position.

Parameters
positionInsertion point.
otherList that owns the range.
firstFirst element to relink.
lastOne past the last element to relink.

◆ splice() [3/3]

template<Type::SafeValue T>
void StormByte::Safe::List< T >::splice ( const_iterator position,
List< T > & other,
const_iterator source )
noexcept

Relink the node at source before position.

Parameters
positionInsertion point.
otherList that owns source.
sourceElement to relink. Not end.

◆ swap()

template<Type::SafeValue T>
void StormByte::Safe::List< T >::swap ( List< T > & other)
noexcept

Exchange chains.

Does not allocate.

Parameters
otherList to exchange with.

◆ unique() [1/2]

template<Type::SafeValue T>
size_type StormByte::Safe::List< T >::unique ( )

Erase consecutive duplicates.

Equality is operator==.

Returns
Number of erased elements.

◆ unique() [2/2]

template<Type::SafeValue T>
template<class Predicate>
size_type StormByte::Safe::List< T >::unique ( Predicate predicate)

Erase consecutive elements for which predicate is true.

Template Parameters
PredicateBinary predicate.
Parameters
predicateDuplicate condition.
Returns
Number of erased elements.

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