xentara-utils v2.0.4
The Xentara Utility Library
Loading...
Searching...
No Matches
xentara::utils::core::RawVector< Element, Allocator > Class Template Reference

A block of raw data. More...

#include <xentara/utils/core/RawVector.hpp>

Public Types

using value_type = Element
 The element type.
 
using allocator_type = Allocator
 The Allocator type.
 
using size_type = typename std::allocator_traits< Allocator >::size_type
 The type used for sizes.
 
using difference_type = typename std::allocator_traits< Allocator >::difference_type
 The type used for distances.
 
using reference = value_type &
 A reference to an element.
 
using const_reference = const value_type &
 A const reference to an element.
 
using pointer = typename std::allocator_traits< Allocator >::pointer
 A pointer to an element.
 
using const_pointer = typename std::allocator_traits< Allocator >::const_pointer
 A const pointer to an element.
 
using iterator = ContiguousIterator< pointer, RawVector >
 An iterator.
 
using const_iterator = ContiguousIterator< const_pointer, RawVector >
 A const iterator.
 
using reverse_iterator = std::reverse_iterator< iterator >
 An iterator for iterating in reverse order.
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 A const iterator for iterating in reverse order.
 

Public Member Functions

internal internal constexpr auto operator= (std::initializer_list< Element > values) -> RawVector &
 Assignment operator for an initializer list.
 
constexpr auto assign (size_type size, const Element &value) -> void
 Fills the vector with a certain value.
 
template<std::input_iterator InputIterator>
constexpr auto assign (InputIterator first, InputIterator last) -> void
 Copies a range of elements.
 
constexpr auto assign (std::initializer_list< Element > values) -> void
 Constructor that initializes the elements using an initializer list.
 
constexpr auto get_allocator () const noexcept -> allocator_type
 Returns a copy of the allocator.
 
constexpr auto operator== (const RawVector &rhs) const noexcept -> bool
 Equality operator.
 
constexpr auto operator<=> (const RawVector &rhs) const noexcept -> std::compare_three_way_result_t< value_type >
 Three-Way-Comparison operator.
 
Constructors
constexpr RawVector () noexcept(noexcept(Allocator()))=default
 Default constructor.
 
constexpr RawVector (const Allocator &allocator) noexcept
 Constructor that sets the allocator.
 
constexpr RawVector (size_type size, const Allocator &allocator=Allocator())
 Constructor that creates an uninitialized vector of a certain size.
 
constexpr RawVector (size_type size, const Element &value, const Allocator &allocator=Allocator())
 Constructor that fills the vector with a certain value.
 
template<std::input_iterator InputIterator>
constexpr RawVector (InputIterator first, InputIterator last, const Allocator &allocator=Allocator())
 Constructor that copies a range of elements.
 
constexpr RawVector (const RawVector &other, const Allocator &allocator)
 Constructor that copies the data but not the allocator.
 
constexpr RawVector (RawVector &&other, const Allocator &allocator)
 Constructor that moves the data but not the allocator.
 
constexpr RawVector (std::initializer_list< Element > values, const Allocator &allocator=Allocator())
 Constructor that initializes the elements using an initializer list.
 
Element Access
constexpr auto at (size_type index) const -> const_reference
 Accesses the element at a certain index.
 
constexpr auto at (size_type index) -> reference
 Accesses the element at a certain index.
 
constexpr auto operator[] (size_type index) const noexcept -> const_reference
 Subscript operator.
 
constexpr auto operator[] (size_type index) noexcept -> reference
 Subscript operator.
 
constexpr auto front () const noexcept -> const_reference
 Returns the first element.
 
constexpr auto front () noexcept -> reference
 Returns the first element.
 
constexpr auto back () const noexcept -> const_reference
 Returns the last element.
 
constexpr auto back () noexcept -> reference
 Returns the last element.
 
constexpr auto data () const noexcept -> const value_type *
 Raw access to the data.
 
constexpr auto data () noexcept -> value_type *
 Raw access to the data.
 
Iterators
constexpr auto begin () noexcept -> iterator
 Creates a begin iterator.
 
constexpr auto begin () const noexcept -> const_iterator
 Creates a begin iterator.
 
constexpr auto cbegin () const noexcept -> const_iterator
 Creates a begin iterator.
 
constexpr auto end () noexcept -> iterator
 Creates an end iterator.
 
constexpr auto end () const noexcept -> const_iterator
 Creates an end iterator.
 
constexpr auto cend () const noexcept -> const_iterator
 Creates an end iterator.
 
constexpr auto rbegin () noexcept -> reverse_iterator
 Creates a reverse begin iterator.
 
constexpr auto rbegin () const noexcept -> const_reverse_iterator
 Creates a reverse begin iterator.
 
constexpr auto crbegin () const noexcept -> const_reverse_iterator
 Creates a reverse begin iterator.
 
constexpr auto rend () noexcept -> reverse_iterator
 Creates a reverse end iterator.
 
constexpr auto rend () const noexcept -> const_reverse_iterator
 Creates a reverse end iterator.
 
constexpr auto crend () const noexcept -> const_reverse_iterator
 Creates a reverse end iterator.
 
Capacity
constexpr auto empty () const noexcept -> bool
 Determines whether the data is empty.
 
constexpr auto size () const noexcept -> size_type
 Gets the size of the data.
 
constexpr auto max_size () const noexcept -> size_type
 Gets the maximum possible data size.
 
constexpr auto reserve (size_type capacity) -> void
 Increases the capacity of the vector.
 
constexpr auto capacity () const noexcept -> size_type
 Gets the capacity of the data.
 
constexpr auto shrink_to_fit () -> void
 Discards any unused capacity.
 
Modifiers
constexpr auto clear () noexcept -> void
 Erases all elements.
 
constexpr auto insert (const_iterator where, const Element &value) -> iterator
 Inserts an element at a certain position.
 
constexpr auto insert (const_iterator where, Element &&value) -> iterator
 Move-Inserts an element at a certain position.
 
constexpr auto insert (const_iterator where, size_type count, UninitializedTag tag) -> iterator
 Inserts a number of uninitialized elements at a certain position.
 
constexpr auto insert (const_iterator where, size_type count, const Element &value) -> iterator
 Inserts a number of copies of a element at a certain position.
 
template<std::input_iterator InputIterator>
constexpr auto insert (const_iterator where, InputIterator first, InputIterator last) -> iterator
 Inserts a range of values at a certain position.
 
constexpr auto insert (const_iterator where, std::initializer_list< Element > values) -> iterator
 Inserts a list of values at a certain position.
 
template<typename... Arguments>
constexpr auto emplace (const_iterator where, Arguments &&... arguments) -> iterator
 Creates an element at a certain position.
 
constexpr auto erase (const_iterator position) -> iterator
 Removes an element from the vector.
 
constexpr auto erase (const_iterator first, const_iterator last) -> iterator
 Removes a range of elements from the vector.
 
constexpr auto push_back (const Element &value) -> void
 Appends an element to the back of the vector.
 
constexpr auto push_back (Element &&value) -> void
 Move-Appends an element to the back of the vector.
 
template<typename... Arguments>
constexpr auto emplace_back (Arguments &&... arguments) -> reference
 Appends a newly created element to the back of the vector.
 
constexpr auto pop_back () -> void
 Removes the last element.
 
constexpr auto resize (size_type newSize) -> void
 Resizes the vector.
 
constexpr auto resize (size_type newSize, const value_type &fillValue) -> void
 Resizes the vector.
 
constexpr auto swap (RawVector &other) noexcept -> void
 Swaps the contents of this vector with another vector.
 

Detailed Description

template<typename Element, typename Allocator = std::allocator<Element>>
requires std::is_trivial_v<Element>
class xentara::utils::core::RawVector< Element, Allocator >

A block of raw data.

This class behaves exactly like std::vector, but does not value-initialize new elements.

Template Parameters
ElementThe type for the elements. Must be a trivial type.
AllocatorThe type for the allocator. Allocator::construct() and Allocator::destroy() are not used.

Member Typedef Documentation

◆ allocator_type

template<typename Element , typename Allocator = std::allocator<Element>>
using xentara::utils::core::RawVector< Element, Allocator >::allocator_type = Allocator

The Allocator type.

◆ const_iterator

template<typename Element , typename Allocator = std::allocator<Element>>
using xentara::utils::core::RawVector< Element, Allocator >::const_iterator = ContiguousIterator<const_pointer, RawVector>

A const iterator.

◆ const_pointer

template<typename Element , typename Allocator = std::allocator<Element>>
using xentara::utils::core::RawVector< Element, Allocator >::const_pointer = typename std::allocator_traits<Allocator>::const_pointer

A const pointer to an element.

◆ const_reference

template<typename Element , typename Allocator = std::allocator<Element>>
using xentara::utils::core::RawVector< Element, Allocator >::const_reference = const value_type &

A const reference to an element.

◆ const_reverse_iterator

template<typename Element , typename Allocator = std::allocator<Element>>
using xentara::utils::core::RawVector< Element, Allocator >::const_reverse_iterator = std::reverse_iterator<const_iterator>

A const iterator for iterating in reverse order.

◆ difference_type

template<typename Element , typename Allocator = std::allocator<Element>>
using xentara::utils::core::RawVector< Element, Allocator >::difference_type = typename std::allocator_traits<Allocator>::difference_type

The type used for distances.

◆ iterator

template<typename Element , typename Allocator = std::allocator<Element>>
using xentara::utils::core::RawVector< Element, Allocator >::iterator = ContiguousIterator<pointer, RawVector>

An iterator.

◆ pointer

template<typename Element , typename Allocator = std::allocator<Element>>
using xentara::utils::core::RawVector< Element, Allocator >::pointer = typename std::allocator_traits<Allocator>::pointer

A pointer to an element.

◆ reference

template<typename Element , typename Allocator = std::allocator<Element>>
using xentara::utils::core::RawVector< Element, Allocator >::reference = value_type &

A reference to an element.

◆ reverse_iterator

template<typename Element , typename Allocator = std::allocator<Element>>
using xentara::utils::core::RawVector< Element, Allocator >::reverse_iterator = std::reverse_iterator<iterator>

An iterator for iterating in reverse order.

◆ size_type

template<typename Element , typename Allocator = std::allocator<Element>>
using xentara::utils::core::RawVector< Element, Allocator >::size_type = typename std::allocator_traits<Allocator>::size_type

The type used for sizes.

◆ value_type

template<typename Element , typename Allocator = std::allocator<Element>>
using xentara::utils::core::RawVector< Element, Allocator >::value_type = Element

The element type.

Constructor & Destructor Documentation

◆ RawVector() [1/8]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr xentara::utils::core::RawVector< Element, Allocator >::RawVector ( )
constexprdefaultnoexcept

Default constructor.

Constructs an empty vector with a default constructed allocator.

◆ RawVector() [2/8]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr xentara::utils::core::RawVector< Element, Allocator >::RawVector ( const Allocator &  allocator)
explicitconstexprnoexcept

Constructor that sets the allocator.

Parameters
allocatorThe allocator

◆ RawVector() [3/8]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr xentara::utils::core::RawVector< Element, Allocator >::RawVector ( size_type  size,
const Allocator &  allocator = Allocator() 
)
explicitconstexpr

Constructor that creates an uninitialized vector of a certain size.

Creates a vector of the given size but leaves the elements uninitialized.

Parameters
sizeThe number of entries to create room for
allocatorThe allocator

◆ RawVector() [4/8]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr xentara::utils::core::RawVector< Element, Allocator >::RawVector ( size_type  size,
const Element &  value,
const Allocator &  allocator = Allocator() 
)
constexpr

Constructor that fills the vector with a certain value.

Creates a vector of the given size and fills it with the given value.

Parameters
sizeThe number of entries to create
valueThe value to set the entries to
allocatorThe allocator

◆ RawVector() [5/8]

template<typename Element , typename Allocator = std::allocator<Element>>
template<std::input_iterator InputIterator>
constexpr xentara::utils::core::RawVector< Element, Allocator >::RawVector ( InputIterator  first,
InputIterator  last,
const Allocator &  allocator = Allocator() 
)
constexpr

Constructor that copies a range of elements.

Creates a vector that holds copies of the given input range.

Parameters
firstThe first element to copy
lastThe position after the last element to copy
allocatorThe allocator

◆ RawVector() [6/8]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr xentara::utils::core::RawVector< Element, Allocator >::RawVector ( const RawVector< Element, Allocator > &  other,
const Allocator &  allocator 
)
constexpr

Constructor that copies the data but not the allocator.

Copies the data of another vector, but uses a different allocator

Parameters
otherThe vector to copy
allocatorThe allocator

◆ RawVector() [7/8]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr xentara::utils::core::RawVector< Element, Allocator >::RawVector ( RawVector< Element, Allocator > &&  other,
const Allocator &  allocator 
)
constexpr

Constructor that moves the data but not the allocator.

Moves the data from another vector, but uses a different allocator

Parameters
otherThe vector to move
allocatorThe allocator

◆ RawVector() [8/8]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr xentara::utils::core::RawVector< Element, Allocator >::RawVector ( std::initializer_list< Element >  values,
const Allocator &  allocator = Allocator() 
)
constexpr

Constructor that initializes the elements using an initializer list.

Parameters
valuesThe values to initialize the elements to
allocatorThe allocator

Member Function Documentation

◆ assign() [1/3]

template<typename Element , typename Allocator = std::allocator<Element>>
template<std::input_iterator InputIterator>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::assign ( InputIterator  first,
InputIterator  last 
) -> void
constexpr

Copies a range of elements.

Replaces the contents of the vector with a given input range.

Parameters
firstThe first element to copy
lastThe position after the last element to copy

◆ assign() [2/3]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::assign ( size_type  size,
const Element &  value 
) -> void
constexpr

Fills the vector with a certain value.

Resizes the vector to the given size and fills it with the given value.

Parameters
sizeThe number of entries to create
valueThe value to set the entries to

◆ assign() [3/3]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::assign ( std::initializer_list< Element >  values) -> void
constexpr

Constructor that initializes the elements using an initializer list.

Replaces the contents of the vector with the contents of an initializer list.

Parameters
valuesThe initializer list

◆ at() [1/2]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::at ( size_type  index) -> reference
constexpr

Accesses the element at a certain index.

Parameters
indexThe index
Returns
A reference to the element at the given index
Exceptions
std::out_of_rangeindex is out of range

◆ at() [2/2]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::at ( size_type  index) const -> const_reference
constexpr

Accesses the element at a certain index.

Parameters
indexThe index
Returns
A reference to the element at the given index
Exceptions
std::out_of_rangeindex is out of range

◆ back() [1/2]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::back ( ) const -> const_reference
constexprnoexcept

Returns the last element.

Note
Must not be called on an empty vector
Returns
A reference to last element

◆ back() [2/2]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::back ( ) -> reference
constexprnoexcept

Returns the last element.

Note
Must not be called on an empty vector
Returns
A reference to last element

◆ begin() [1/2]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::begin ( ) const -> const_iterator
constexprnoexcept

Creates a begin iterator.

Returns
An iterator pointing at the first element, or end(), if the data is empty

◆ begin() [2/2]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::begin ( ) -> iterator
constexprnoexcept

Creates a begin iterator.

Returns
An iterator pointing at the first element, or end(), if the data is empty

◆ capacity()

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::capacity ( ) const -> size_type
constexprnoexcept

Gets the capacity of the data.

Returns
The total number of elements the object can hold without reallocating

◆ cbegin()

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::cbegin ( ) const -> const_iterator
constexprnoexcept

Creates a begin iterator.

Returns
An iterator pointing at the first element, or end(), if the data is empty

◆ cend()

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::cend ( ) const -> const_iterator
constexprnoexcept

Creates an end iterator.

Returns
An iterator pointing at the position past the last element

◆ clear()

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::clear ( ) -> void
constexprnoexcept

Erases all elements.

◆ crbegin()

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::crbegin ( ) const -> const_reverse_iterator
constexprnoexcept

Creates a reverse begin iterator.

Returns
A reverse iterator pointing at the last element, or rend(), if the data is empty

◆ crend()

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::crend ( ) const -> const_reverse_iterator
constexprnoexcept

Creates a reverse end iterator.

Returns
A reverse iterator pointing at the position before the first element

◆ data() [1/2]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::data ( ) const -> const value_type *
constexprnoexcept

Raw access to the data.

Returns a pointer to the underlying array that serves as element storage.

Returns
A pointer to the first element. If the array is empty, the pointer is not dereferencable.

◆ data() [2/2]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::data ( ) -> value_type *
constexprnoexcept

Raw access to the data.

Returns a pointer to the underlying array that serves as element storage.

Returns
A pointer to the first element. If the array is empty, the pointer is not dereferencable.

◆ emplace()

template<typename Element , typename Allocator = std::allocator<Element>>
template<typename... Arguments>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::emplace ( const_iterator  where,
Arguments &&...  arguments 
) -> iterator
constexpr

Creates an element at a certain position.

Parameters
whereThe desired position of the new element. Must be a position within the vector, or cend() to append the element.
argumentsThe arguments to pass to the element's constructor
Returns
The actual position of the new element. Can be different from where if a reallocation was necessary.

◆ emplace_back()

template<typename Element , typename Allocator = std::allocator<Element>>
template<typename... Arguments>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::emplace_back ( Arguments &&...  arguments) -> reference
constexpr

Appends a newly created element to the back of the vector.

Parameters
argumentsThe arguments to pass to the element's constructor
Returns
A reference to the new value

◆ empty()

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::empty ( ) const -> bool
constexprnoexcept

Determines whether the data is empty.

Returns
Whether the data is empty

◆ end() [1/2]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::end ( ) const -> const_iterator
constexprnoexcept

Creates an end iterator.

Returns
An iterator pointing at the position past the last element

◆ end() [2/2]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::end ( ) -> iterator
constexprnoexcept

Creates an end iterator.

Returns
An iterator pointing at the position past the last element

◆ erase() [1/2]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::erase ( const_iterator  first,
const_iterator  last 
) -> iterator
constexpr

Removes a range of elements from the vector.

Parameters
firstAn iterator to the first element to remove
lastAn iterator one position past the last element to remove
Returns
An iterator to the element after the last removed one.

◆ erase() [2/2]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::erase ( const_iterator  position) -> iterator
constexpr

Removes an element from the vector.

Parameters
positionThe position of the element to remove. Must point to a valid element.
Returns
An iterator to the element after the removed one.

◆ front() [1/2]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::front ( ) const -> const_reference
constexprnoexcept

Returns the first element.

Note
Must not be called on an empty vector
Returns
A reference to first element

◆ front() [2/2]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::front ( ) -> reference
constexprnoexcept

Returns the first element.

Note
Must not be called on an empty vector
Returns
A reference to first element

◆ get_allocator()

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::get_allocator ( ) const -> allocator_type
constexprnoexcept

Returns a copy of the allocator.

Returns
A copy of allocator associated with the vector

◆ insert() [1/6]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::insert ( const_iterator  where,
const Element &  value 
) -> iterator
constexpr

Inserts an element at a certain position.

Parameters
whereThe desired position of the new element. Must be a position within the vector, or cend() to append the element.
valueThe value to insert
Returns
The actual position of the new element. Can be different from where if a reallocation was necessary.

◆ insert() [2/6]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::insert ( const_iterator  where,
Element &&  value 
) -> iterator
constexpr

Move-Inserts an element at a certain position.

Parameters
whereThe desired position of the new element. Must be a position within the vector, or cend() to append the element.
valueThe value to move
Returns
The actual position of the new element. Can be different from where if a reallocation was necessary.

◆ insert() [3/6]

template<typename Element , typename Allocator = std::allocator<Element>>
template<std::input_iterator InputIterator>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::insert ( const_iterator  where,
InputIterator  first,
InputIterator  last 
) -> iterator
constexpr

Inserts a range of values at a certain position.

Parameters
whereThe desired position of the first new element. Must be a position within the vector, or cend() to append the elements.
firstAn iterator to the first value to insert
lastAn iterator one position past the last value to insert
Returns
The actual position of the first new element. Can be different from where if a reallocation was necessary.

◆ insert() [4/6]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::insert ( const_iterator  where,
size_type  count,
const Element &  value 
) -> iterator
constexpr

Inserts a number of copies of a element at a certain position.

Parameters
whereThe desired position of the first new element. Must be a position within the vector, or cend() to append the elements.
countThe number of copies to insert
valueThe value to insert
Returns
The actual position of the first new element. Can be different from where if a reallocation was necessary.

◆ insert() [5/6]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::insert ( const_iterator  where,
size_type  count,
UninitializedTag  tag 
) -> iterator
constexpr

Inserts a number of uninitialized elements at a certain position.

Parameters
whereThe desired position of the first new element. Must be a position within the vector, or cend() to append the elements.
countThe number of elements to insert
tagAlways pass kUninitialized as this parameter
Returns
The actual position of the first new element. Can be different from where if a reallocation was necessary.

◆ insert() [6/6]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::insert ( const_iterator  where,
std::initializer_list< Element >  values 
) -> iterator
constexpr

Inserts a list of values at a certain position.

Parameters
whereThe desired position of the first new element. Must be a position within the vector, or cend() to append the elements.
valuesThe values to insert
Returns
The actual position of the first new element. Can be different from where if a reallocation was necessary.

◆ max_size()

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::max_size ( ) const -> size_type
constexprnoexcept

Gets the maximum possible data size.

Returns
The maximum data size that can be allocated

◆ operator<=>()

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::operator<=> ( const RawVector< Element, Allocator > &  rhs) const -> std::compare_three_way_result_t<value_type>
constexprnoexcept

Three-Way-Comparison operator.

Performs a lexicographical comparison of the elements of two vectors

◆ operator=()

template<typename Element , typename Allocator = std::allocator<Element>>
internal internal constexpr auto xentara::utils::core::RawVector< Element, Allocator >::operator= ( std::initializer_list< Element >  values) -> RawVector &
constexpr

Assignment operator for an initializer list.

Parameters
valuesThe values to assign
Returns
A reference to this vector

◆ operator==()

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::operator== ( const RawVector< Element, Allocator > &  rhs) const -> bool
constexprnoexcept

Equality operator.

Tests the contents of two vectors for equality

◆ operator[]() [1/2]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::operator[] ( size_type  index) const -> const_reference
constexprnoexcept

Subscript operator.

Returns a reference to the element at a certain index

Parameters
indexThe index
Returns
A reference to the value at the given offset

◆ operator[]() [2/2]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::operator[] ( size_type  index) -> reference
constexprnoexcept

Subscript operator.

Returns a reference to the element at a certain index

Parameters
indexThe index
Returns
A reference to the value at the given offset

◆ pop_back()

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::pop_back ( ) -> void
constexpr

Removes the last element.

Note
Must not be called on an empty vector

◆ push_back() [1/2]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::push_back ( const Element &  value) -> void
constexpr

Appends an element to the back of the vector.

Parameters
valueThe value to insert

◆ push_back() [2/2]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::push_back ( Element &&  value) -> void
constexpr

Move-Appends an element to the back of the vector.

Parameters
valueThe value to move

◆ rbegin() [1/2]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::rbegin ( ) const -> const_reverse_iterator
constexprnoexcept

Creates a reverse begin iterator.

Returns
A reverse iterator pointing at the last element, or rend(), if the data is empty

◆ rbegin() [2/2]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::rbegin ( ) -> reverse_iterator
constexprnoexcept

Creates a reverse begin iterator.

Returns
A reverse iterator pointing at the last element, or rend(), if the data is empty

◆ rend() [1/2]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::rend ( ) const -> const_reverse_iterator
constexprnoexcept

Creates a reverse end iterator.

Returns
A reverse iterator pointing at the position before the first element

◆ rend() [2/2]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::rend ( ) -> reverse_iterator
constexprnoexcept

Creates a reverse end iterator.

Returns
A reverse iterator pointing at the position before the first element

◆ reserve()

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::reserve ( size_type  capacity) -> void
constexpr

Increases the capacity of the vector.

Pre-Allocates storage for more data. Can be used to improve performance when repeatedly appending data. If capacity is less than or equal to the current capacity, the function does nothing.

Parameters
capacityThe new capacity.

◆ resize() [1/2]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::resize ( size_type  newSize) -> void
constexpr

Resizes the vector.

Grows or shrinks the vector to a new size. If the new size is greater than the old size, the new elements are left uninitialized.

Note
This function never reduces the vector's capacity, and hence does not invalidate any but the end iterator.
Parameters
newSizeThe new size for the vector.

◆ resize() [2/2]

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::resize ( size_type  newSize,
const value_type fillValue 
) -> void
constexpr

Resizes the vector.

Grows or shrinks the vector to a new size. If the new size is greater than the old size, the new elements are filled with copies of fillValue.

Note
This function never reduces the vector's capacity, and hence does not invalidate any but the end iterator.
Parameters
newSizeThe new size for the vector.
fillValueThe value that should be used to initialize new element.

◆ shrink_to_fit()

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::shrink_to_fit ( ) -> void
constexpr

Discards any unused capacity.

Reduces the allocated size so that the capacity is exactly enough to hold the data.

◆ size()

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::size ( ) const -> size_type
constexprnoexcept

Gets the size of the data.

Returns
The number of elements contained in the data

◆ swap()

template<typename Element , typename Allocator = std::allocator<Element>>
constexpr auto xentara::utils::core::RawVector< Element, Allocator >::swap ( RawVector< Element, Allocator > &  other) -> void
constexprnoexcept

Swaps the contents of this vector with another vector.

Attention
If std::allocator_traits<Allocator>::propagate_on_container_swap is false, then the allocators of the two vectors must be compatible
Parameters
otherThe vector to swap with