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

Contiguous sequence stored on Base's heap. More...

#include <StormByte/safe/vector.hxx>

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 pointer = T*
 Mutable element pointer.
using const_pointer = const T*
 Read-only element pointer.
using iterator = T*
 Mutable contiguous iterator.
using const_iterator = const T*
 Read-only contiguous 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

 Vector () noexcept
 Construct an empty sequence.
 Vector (size_type count)
 Construct count value-initialized elements.
 Vector (size_type count, const T &value)
 Construct count copies of value.
template<std::input_iterator InputIt>
 Vector (InputIt first, InputIt last)
 Copy the range [first, last).
 Vector (std::initializer_list< T > values)
 Construct from an initializer list.
 Vector (const std::vector< T > &values)
 Copy a caller-owned STL vector.
STORMBYTE_FORCE_INLINE Vector (std::vector< T > &&values)
 Move elements from a caller-owned STL vector and leave it empty.
 Vector (const Vector &other)
 Copy every element into a new Base block.
 Vector (Vector &&other) noexcept
 Take the block.
 ~Vector () noexcept
 Destroy every element and release the block.
Vector & operator= (const Vector &other)
 Copy-assign.
Vector & operator= (Vector &&other) noexcept
 Move-assign.
Vector & operator= (std::initializer_list< T > values)
 Replace the contents with an initializer list.
Vector & operator= (const std::vector< T > &values)
 Copy-assign a caller-owned STL vector.
STORMBYTE_FORCE_INLINE Vector & operator= (std::vector< T > &&values)
 Move-assign elements from a caller-owned STL vector and leave it empty.
iterator begin () noexcept
 Return a mutable iterator to the first element.
iterator end () noexcept
 Return the mutable end iterator.
const_iterator begin () const noexcept
 Return a read-only iterator to the first element.
const_iterator end () const noexcept
 Return the read-only end iterator.
const_iterator cbegin () const noexcept
 Return a read-only iterator to the first element.
const_iterator cend () const noexcept
 Return the read-only end iterator.
STORMBYTE_FORCE_INLINE reverse_iterator rbegin () noexcept
 Return a mutable reverse iterator to the last element.
STORMBYTE_FORCE_INLINE reverse_iterator rend () noexcept
 Return the mutable reverse end iterator.
STORMBYTE_FORCE_INLINE const_reverse_iterator rbegin () const noexcept
 Return a read-only reverse iterator to the last element.
STORMBYTE_FORCE_INLINE const_reverse_iterator rend () const noexcept
 Return the read-only reverse end iterator.
STORMBYTE_FORCE_INLINE const_reverse_iterator crbegin () const noexcept
 Return a read-only reverse iterator to the last element.
STORMBYTE_FORCE_INLINE const_reverse_iterator crend () const noexcept
 Return the read-only reverse end iterator.
bool empty () const noexcept
 Test whether the sequence is empty.
size_type size () const noexcept
 Return the element count.
STORMBYTE_FORCE_INLINE size_type max_size () const noexcept
 Return the largest representable element count.
size_type capacity () const noexcept
 Return the allocated capacity.
pointer data () noexcept
 Return a pointer to the block.
const_pointer data () const noexcept
 Return a pointer to the block.
STORMBYTE_FORCE_INLINE operator std::span< T > () noexcept
 Borrow the occupied elements.
STORMBYTE_FORCE_INLINE operator std::span< const T > () const noexcept
 Borrow the occupied elements.
void reserve (size_type count)
 Reserve room for at least count elements.
void shrink_to_fit ()
 Release unused capacity.
void clear () noexcept
 Destroy every element.
void swap (Vector &other) noexcept
 Exchange blocks.
reference operator[] (size_type index) noexcept
 Access an element.
const_reference operator[] (size_type index) const noexcept
 Access an element.
reference at (size_type index)
 Access an element.
const_reference at (size_type index) const
 Access an element.
reference front ()
 Return the first element.
const_reference front () const
 Return the first element.
reference back ()
 Return the last element.
const_reference back () const
 Return the last element.
void push_back (const T &value)
 Append a copy.
void push_back (T &&value)
 Append a moved value.
template<std::ranges::input_range R>
void append_range (R &&range)
 Append a copy of each element of range.
void pop_back ()
 Remove the last element.
template<class... Args>
reference emplace_back (Args &&... args)
 Construct an element at the end.
iterator insert (const_iterator position, const T &value)
 Insert a copy 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 before position.
template<std::input_iterator InputIt>
iterator insert (const_iterator position, InputIt first, InputIt last)
 Insert [first, last) before position.
iterator insert (const_iterator position, std::initializer_list< T > values)
 Insert an initializer list before position.
template<std::ranges::input_range R>
iterator insert_range (const_iterator position, R &&range)
 Insert a copy of each element of range before position.
template<class... Args>
iterator emplace (const_iterator position, Args &&... args)
 Construct an element before position.
iterator erase (const_iterator position)
 Erase one element.
iterator erase (const_iterator first, const_iterator last)
 Erase a half-open range.
void assign (size_type count, const T &value)
 Replace the contents with count copies.
template<std::input_iterator InputIt>
void assign (InputIt first, InputIt last)
 Replace the contents with [first, last).
void assign (std::initializer_list< T > values)
 Replace the contents with an initializer list.
template<std::ranges::input_range R>
void assign_range (R &&range)
 Replace the contents with a copy of range.
void resize (size_type count)
 Change the size, value-initializing new elements.
void resize (size_type count, const T &value)
 Change the size, copying value into new elements.
bool operator== (const Vector &other) const
 Compare elements in order.
STORMBYTE_FORCE_INLINE std::strong_ordering operator<=> (const Vector &other) const
 Order sequences lexicographically.
bool operator< (const Vector &other) const
 Order sequences lexicographically.
bool operator<= (const Vector &other) const
 Order sequences lexicographically.
bool operator> (const Vector &other) const
 Order sequences lexicographically.
bool operator>= (const Vector &other) const
 Order sequences lexicographically.
STORMBYTE_FORCE_INLINE operator std::vector< T > () const
 Copy the elements into caller-owned STL storage.

Detailed Description

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

Contiguous sequence stored on Base's heap.

Template Parameters
TSafe value.

The block is allocated with Heap::Allocate. Iterators are pointers into that block. A move from std::vector moves the elements and clears the source in the caller, so its buffer is released by the caller's CRT. A range constructor copies elements. It does not adopt the source buffer. Conversion to std::span borrows the block and does not take ownership. There is no allocator: that would be the caller CRT.

Member Typedef Documentation

◆ const_iterator

template<Type::SafeValue T>
using StormByte::Safe::Vector< T >::const_iterator = const T*

Read-only contiguous iterator.

◆ const_pointer

template<Type::SafeValue T>
using StormByte::Safe::Vector< T >::const_pointer = const T*

Read-only element pointer.

◆ const_reference

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

Read-only element reference.

◆ const_reverse_iterator

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

Read-only reverse iterator.

◆ difference_type

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

Iterator distance type.

◆ iterator

template<Type::SafeValue T>
using StormByte::Safe::Vector< T >::iterator = T*

Mutable contiguous iterator.

◆ pointer

template<Type::SafeValue T>
using StormByte::Safe::Vector< T >::pointer = T*

Mutable element pointer.

◆ reference

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

Mutable element reference.

◆ reverse_iterator

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

Mutable reverse iterator.

◆ size_type

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

Element count. Size, not std::size_t.

◆ value_type

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

Element type.

Constructor & Destructor Documentation

◆ Vector() [1/9]

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

Construct an empty sequence.

◆ Vector() [2/9]

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

Construct count value-initialized elements.

Parameters
countElement count.
Exceptions
AllocationErrorThe block could not be allocated.

◆ Vector() [3/9]

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

Construct count copies of value.

Parameters
countElement count.
valueValue to copy.
Exceptions
AllocationErrorThe block could not be allocated.

◆ Vector() [4/9]

template<Type::SafeValue T>
template<std::input_iterator InputIt>
StormByte::Safe::Vector< T >::Vector ( InputIt first,
InputIt last )

Copy the range [first, last).

Template Parameters
InputItInput iterator whose value is convertible to T.
Parameters
firstStart of the source range.
lastEnd of the source range.
Exceptions
AllocationErrorThe block could not be allocated.

◆ Vector() [5/9]

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

Construct from an initializer list.

Parameters
valuesInitial elements.
Exceptions
AllocationErrorThe block could not be allocated.

◆ Vector() [6/9]

template<Type::SafeValue T>
StormByte::Safe::Vector< T >::Vector ( const std::vector< T > & values)
explicit

Copy a caller-owned STL vector.

Its state is unchanged.

Parameters
valuesSource.
Exceptions
AllocationErrorThe block could not be allocated.

◆ Vector() [7/9]

template<Type::SafeValue T>
STORMBYTE_FORCE_INLINE StormByte::Safe::Vector< T >::Vector ( std::vector< T > && values)
inlineexplicit

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

Parameters
valuesSource. Cleared before this function returns.
Exceptions
AllocationErrorThe block could not be allocated.

◆ Vector() [8/9]

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

Copy every element into a new Base block.

Parameters
otherSource.
Exceptions
AllocationErrorThe block could not be allocated.

◆ Vector() [9/9]

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

Take the block.

other is left empty.

Parameters
otherSource.

◆ ~Vector()

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

Destroy every element and release the block.

Member Function Documentation

◆ append_range()

template<Type::SafeValue T>
template<std::ranges::input_range R>
void StormByte::Safe::Vector< T >::append_range ( R && range)

Append a copy of each element of range.

Template Parameters
RInput range whose value is convertible to T.
Parameters
rangeSource range. Copied first when it refers to this sequence.
Exceptions
AllocationErrorThe block could not be allocated.

◆ assign() [1/3]

template<Type::SafeValue T>
template<std::input_iterator InputIt>
void StormByte::Safe::Vector< T >::assign ( InputIt first,
InputIt last )

Replace the contents with [first, last).

Template Parameters
InputItInput iterator whose value is convertible to T.
Parameters
firstStart of the source range.
lastEnd of the source range.
Exceptions
AllocationErrorThe block could not be allocated.

◆ assign() [2/3]

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

Replace the contents with count copies.

Parameters
countElement count.
valueValue to copy.
Exceptions
AllocationErrorThe block could not be allocated.

◆ assign() [3/3]

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

Replace the contents with an initializer list.

Parameters
valuesNew elements.
Exceptions
AllocationErrorThe block could not be allocated.

◆ assign_range()

template<Type::SafeValue T>
template<std::ranges::input_range R>
void StormByte::Safe::Vector< T >::assign_range ( R && range)

Replace the contents with a copy of range.

Template Parameters
RInput range whose value is convertible to T.
Parameters
rangeSource range. Copied first when it refers to this sequence.
Exceptions
AllocationErrorThe block could not be allocated.

◆ at() [1/2]

template<Type::SafeValue T>
reference StormByte::Safe::Vector< T >::at ( size_type index)

Access an element.

Parameters
indexElement index.
Returns
Element reference. Valid until reallocation or erasure.
Exceptions
OutOfBoundsErrorindex is outside the sequence.

◆ at() [2/2]

template<Type::SafeValue T>
const_reference StormByte::Safe::Vector< T >::at ( size_type index) const

Access an element.

Parameters
indexElement index.
Returns
Element reference. Valid until reallocation or erasure.
Exceptions
OutOfBoundsErrorindex is outside the sequence.

◆ back() [1/2]

template<Type::SafeValue T>
reference StormByte::Safe::Vector< T >::back ( )

Return the last element.

Returns
Last element. Valid until reallocation or erasure.
Exceptions
OutOfBoundsErrorThe sequence is empty.

◆ back() [2/2]

template<Type::SafeValue T>
const_reference StormByte::Safe::Vector< T >::back ( ) const

Return the last element.

Returns
Last element. Valid until reallocation or erasure.
Exceptions
OutOfBoundsErrorThe sequence is empty.

◆ begin() [1/2]

template<Type::SafeValue T>
const_iterator StormByte::Safe::Vector< T >::begin ( ) const
noexcept

Return a read-only iterator to the first element.

Returns
Read-only iterator.

◆ begin() [2/2]

template<Type::SafeValue T>
iterator StormByte::Safe::Vector< T >::begin ( )
noexcept

Return a mutable iterator to the first element.

Returns
Mutable iterator.

◆ capacity()

template<Type::SafeValue T>
size_type StormByte::Safe::Vector< T >::capacity ( ) const
noexcept

Return the allocated capacity.

Returns
Capacity in elements.

◆ cbegin()

template<Type::SafeValue T>
const_iterator StormByte::Safe::Vector< T >::cbegin ( ) const
noexcept

Return a read-only iterator to the first element.

Returns
Read-only iterator.

◆ cend()

template<Type::SafeValue T>
const_iterator StormByte::Safe::Vector< T >::cend ( ) const
noexcept

Return the read-only end iterator.

Returns
End iterator.

◆ clear()

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

Destroy every element.

Capacity is kept.

◆ crbegin()

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

Return a read-only reverse iterator to the last element.

Returns
Reverse iterator.

◆ crend()

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

Return the read-only reverse end iterator.

Returns
Reverse end iterator.

◆ data() [1/2]

template<Type::SafeValue T>
const_pointer StormByte::Safe::Vector< T >::data ( ) const
noexcept

Return a pointer to the block.

Returns
Block address, or null when no capacity is reserved.

◆ data() [2/2]

template<Type::SafeValue T>
pointer StormByte::Safe::Vector< T >::data ( )
noexcept

Return a pointer to the block.

Returns
Block address, or null when no capacity is reserved.

◆ emplace()

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

Construct an element before position.

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

◆ emplace_back()

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

Construct an element at the end.

Template Parameters
ArgsConstructor argument types.
Parameters
argsArguments forwarded to T.
Returns
Reference to the new element. Valid until reallocation or erasure.
Exceptions
AllocationErrorThe block could not be allocated.

◆ empty()

template<Type::SafeValue T>
bool StormByte::Safe::Vector< T >::empty ( ) const
noexcept

Test whether the sequence is empty.

Returns
Whether there are no elements.

◆ end() [1/2]

template<Type::SafeValue T>
const_iterator StormByte::Safe::Vector< T >::end ( ) const
noexcept

Return the read-only end iterator.

Returns
End iterator.

◆ end() [2/2]

template<Type::SafeValue T>
iterator StormByte::Safe::Vector< T >::end ( )
noexcept

Return the mutable end iterator.

Returns
End iterator.

◆ erase() [1/2]

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

Erase a half-open range.

Parameters
firstFirst element to erase.
lastPast-the-end element.
Returns
Iterator following the erased range.

◆ erase() [2/2]

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

Erase one element.

Parameters
positionElement to erase.
Returns
Iterator following the erased element.

◆ front() [1/2]

template<Type::SafeValue T>
reference StormByte::Safe::Vector< T >::front ( )

Return the first element.

Returns
First element. Valid until reallocation or erasure.
Exceptions
OutOfBoundsErrorThe sequence is empty.

◆ front() [2/2]

template<Type::SafeValue T>
const_reference StormByte::Safe::Vector< T >::front ( ) const

Return the first element.

Returns
First element. Valid until reallocation or erasure.
Exceptions
OutOfBoundsErrorThe sequence is empty.

◆ insert() [1/5]

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

Insert a copy before position.

Parameters
positionInsertion point.
valueValue to copy.
Returns
Iterator to the inserted element.
Exceptions
AllocationErrorThe block could not be allocated.

◆ insert() [2/5]

template<Type::SafeValue T>
template<std::input_iterator InputIt>
iterator StormByte::Safe::Vector< T >::insert ( const_iterator position,
InputIt first,
InputIt last )

Insert [first, last) before position.

Template Parameters
InputItInput iterator whose value is convertible to T.
Parameters
positionInsertion point.
firstStart of the source range.
lastEnd of the source range.
Returns
Iterator to the first inserted element, or position when the range is empty.
Exceptions
AllocationErrorThe block could not be allocated.

◆ insert() [3/5]

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

Insert count copies before position.

Parameters
positionInsertion point.
countCopy count.
valueValue to copy.
Returns
Iterator to the first inserted element, or position when count is zero.
Exceptions
AllocationErrorThe block could not be allocated.

◆ insert() [4/5]

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

Insert an initializer list before position.

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

◆ insert() [5/5]

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

Insert a moved value before position.

Parameters
positionInsertion point.
valueValue to move.
Returns
Iterator to the inserted element.
Exceptions
AllocationErrorThe block could not be allocated.

◆ insert_range()

template<Type::SafeValue T>
template<std::ranges::input_range R>
iterator StormByte::Safe::Vector< T >::insert_range ( const_iterator position,
R && range )

Insert a copy of each element of range before position.

Template Parameters
RInput range whose value is convertible to T.
Parameters
positionInsertion point.
rangeSource range. Copied first when it refers to this sequence.
Returns
Iterator to the first inserted element, or position when range is empty.
Exceptions
AllocationErrorThe block could not be allocated.

◆ max_size()

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

Return the largest representable element count.

Returns
Maximum element count for this element size.

◆ operator std::span< const T >()

template<Type::SafeValue T>
STORMBYTE_FORCE_INLINE StormByte::Safe::Vector< T >::operator std::span< const T > ( ) const
inlinenoexcept

Borrow the occupied elements.

The span does not own the block.

Returns
Read-only span over [data(), data() + size()).

◆ operator std::span< T >()

template<Type::SafeValue T>
STORMBYTE_FORCE_INLINE StormByte::Safe::Vector< T >::operator std::span< T > ( )
inlinenoexcept

Borrow the occupied elements.

The span does not own the block.

Returns
Mutable span over [data(), data() + size()).

◆ operator std::vector< T >()

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

Copy the elements into caller-owned STL storage.

Returns
A std::vector owned by the caller.

◆ operator<()

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

Order sequences lexicographically.

Parameters
otherSequence to compare.
Returns
Whether this sequence precedes other.

◆ operator<=()

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

Order sequences lexicographically.

Parameters
otherSequence to compare.
Returns
Whether this sequence precedes or equals other.

◆ operator<=>()

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

Order sequences lexicographically.

Parameters
otherSequence to compare.
Returns
Ordering of the two sequences.

◆ operator=() [1/5]

template<Type::SafeValue T>
Vector & StormByte::Safe::Vector< T >::operator= ( const std::vector< T > & values)

Copy-assign a caller-owned STL vector.

Its state is unchanged.

Parameters
valuesSource.
Returns
This sequence.
Exceptions
AllocationErrorThe block could not be allocated.

◆ operator=() [2/5]

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

Copy-assign.

The previous block is released only after the copy exists.

Parameters
otherSource.
Returns
This sequence.
Exceptions
AllocationErrorThe block could not be allocated.

◆ operator=() [3/5]

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

Replace the contents with an initializer list.

Parameters
valuesNew elements.
Returns
This sequence.
Exceptions
AllocationErrorThe block could not be allocated.

◆ operator=() [4/5]

template<Type::SafeValue T>
STORMBYTE_FORCE_INLINE Vector & StormByte::Safe::Vector< T >::operator= ( std::vector< T > && values)
inline

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

Parameters
valuesSource. Cleared before this function returns.
Returns
This sequence.
Exceptions
AllocationErrorThe block could not be allocated.

◆ operator=() [5/5]

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

Move-assign.

other is left empty.

Parameters
otherSource.
Returns
This sequence.

◆ operator==()

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

Compare elements in order.

Parameters
otherSequence to compare.
Returns
Whether both sequences contain the same elements.

◆ operator>()

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

Order sequences lexicographically.

Parameters
otherSequence to compare.
Returns
Whether this sequence follows other.

◆ operator>=()

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

Order sequences lexicographically.

Parameters
otherSequence to compare.
Returns
Whether this sequence follows or equals other.

◆ operator[]() [1/2]

template<Type::SafeValue T>
const_reference StormByte::Safe::Vector< T >::operator[] ( size_type index) const
noexcept

Access an element.

Parameters
indexElement index.
Returns
Element reference. Valid until reallocation or erasure.

◆ operator[]() [2/2]

template<Type::SafeValue T>
reference StormByte::Safe::Vector< T >::operator[] ( size_type index)
noexcept

Access an element.

Parameters
indexElement index.
Returns
Element reference. Valid until reallocation or erasure.

◆ pop_back()

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

Remove the last element.

Exceptions
OutOfBoundsErrorThe sequence is empty.

◆ push_back() [1/2]

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

Append a copy.

Parameters
valueValue to copy.
Exceptions
AllocationErrorThe block could not be allocated.

◆ push_back() [2/2]

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

Append a moved value.

Parameters
valueValue to move.
Exceptions
AllocationErrorThe block could not be allocated.

◆ rbegin() [1/2]

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

Return a read-only reverse iterator to the last element.

Returns
Reverse iterator.

◆ rbegin() [2/2]

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

Return a mutable reverse iterator to the last element.

Returns
Reverse iterator.

◆ rend() [1/2]

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

Return the read-only reverse end iterator.

Returns
Reverse end iterator.

◆ rend() [2/2]

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

Return the mutable reverse end iterator.

Returns
Reverse end iterator.

◆ reserve()

template<Type::SafeValue T>
void StormByte::Safe::Vector< T >::reserve ( size_type count)

Reserve room for at least count elements.

A smaller request does not shrink.

Parameters
countMinimum capacity.
Exceptions
AllocationErrorThe block could not be allocated.

◆ resize() [1/2]

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

Change the size, value-initializing new elements.

Parameters
countNew size.
Exceptions
AllocationErrorThe block could not be allocated.

◆ resize() [2/2]

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

Change the size, copying value into new elements.

Parameters
countNew size.
valueValue to copy.
Exceptions
AllocationErrorThe block could not be allocated.

◆ shrink_to_fit()

template<Type::SafeValue T>
void StormByte::Safe::Vector< T >::shrink_to_fit ( )

Release unused capacity.

◆ size()

template<Type::SafeValue T>
size_type StormByte::Safe::Vector< T >::size ( ) const
noexcept

Return the element count.

Returns
Element count.

◆ swap()

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

Exchange blocks.

Does not allocate.

Parameters
otherSequence to exchange with.

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