C/C++ API Reference
Loading...
Searching...
No Matches

Oveview

Classes

class  pw::DynamicVector< T, SizeType >
 

Typedefs

using pw::DynamicVector< T, SizeType >::value_type = T
 
using pw::DynamicVector< T, SizeType >::size_type = SizeType
 
using pw::DynamicVector< T, SizeType >::reference = value_type &
 
using pw::DynamicVector< T, SizeType >::const_reference = const value_type &
 
using pw::DynamicVector< T, SizeType >::pointer = value_type *
 
using pw::DynamicVector< T, SizeType >::const_pointer = const value_type *
 
using pw::DynamicVector< T, SizeType >::iterator = containers::PtrIterator< DynamicVector >
 
using pw::DynamicVector< T, SizeType >::const_iterator = containers::ConstPtrIterator< DynamicVector >
 
using pw::DynamicVector< T, SizeType >::reverse_iterator = std::reverse_iterator< iterator >
 
using pw::DynamicVector< T, SizeType >::const_reverse_iterator = std::reverse_iterator< const_iterator >
 
using pw::DynamicVector< T, SizeType >::allocator_type = Allocator
 

Functions

constexpr pw::DynamicVector< T, SizeType >::DynamicVector (Allocator &allocator)
 
 pw::DynamicVector< T, SizeType >::DynamicVector (const DynamicVector &)=delete
 
DynamicVectorpw::DynamicVector< T, SizeType >::operator= (const DynamicVector &)=delete
 
constexpr pw::DynamicVector< T, SizeType >::DynamicVector (DynamicVector &&)=default
 
constexpr DynamicVectorpw::DynamicVector< T, SizeType >::operator= (DynamicVector &&)=default
 
iterator pw::DynamicVector< T, SizeType >::begin ()
 
const_iterator pw::DynamicVector< T, SizeType >::begin () const
 
const_iterator pw::DynamicVector< T, SizeType >::cbegin () const
 
iterator pw::DynamicVector< T, SizeType >::end ()
 
const_iterator pw::DynamicVector< T, SizeType >::end () const
 
const_iterator pw::DynamicVector< T, SizeType >::cend () const
 
reverse_iterator pw::DynamicVector< T, SizeType >::rbegin ()
 
const_reverse_iterator pw::DynamicVector< T, SizeType >::rbegin () const
 
const_reverse_iterator pw::DynamicVector< T, SizeType >::crbegin () const
 
reverse_iterator pw::DynamicVector< T, SizeType >::rend ()
 
const_reverse_iterator pw::DynamicVector< T, SizeType >::rend () const
 
const_reverse_iterator pw::DynamicVector< T, SizeType >::crend () const
 
constexpr allocator_typepw::DynamicVector< T, SizeType >::get_allocator () const
 Returns the vector's allocator.
 
bool pw::DynamicVector< T, SizeType >::empty () const
 Checks if the vector is empty.
 
size_type pw::DynamicVector< T, SizeType >::size () const
 Returns the number of elements in the vector.
 
size_type pw::DynamicVector< T, SizeType >::capacity () const
 
size_type pw::DynamicVector< T, SizeType >::max_size () const
 Maximum possible value of size(), ignoring allocator limitations.
 
void pw::DynamicVector< T, SizeType >::reserve (size_type new_capacity)
 
void pw::DynamicVector< T, SizeType >::reserve_exact (size_type new_capacity)
 
bool pw::DynamicVector< T, SizeType >::try_reserve (size_type new_capacity)
 
bool pw::DynamicVector< T, SizeType >::try_reserve_exact (size_type new_capacity)
 
void pw::DynamicVector< T, SizeType >::shrink_to_fit ()
 Reduces memory usage by releasing unused capacity.
 
reference pw::DynamicVector< T, SizeType >::operator[] (size_type pos)
 
const_reference pw::DynamicVector< T, SizeType >::operator[] (size_type pos) const
 
reference pw::DynamicVector< T, SizeType >::at (size_type pos)
 
const_reference pw::DynamicVector< T, SizeType >::at (size_type pos) const
 
reference pw::DynamicVector< T, SizeType >::front ()
 
const_reference pw::DynamicVector< T, SizeType >::front () const
 
reference pw::DynamicVector< T, SizeType >::back ()
 
const_reference pw::DynamicVector< T, SizeType >::back () const
 
pointer pw::DynamicVector< T, SizeType >::data ()
 
const_pointer pw::DynamicVector< T, SizeType >::data () const
 
void pw::DynamicVector< T, SizeType >::assign (size_type count, const value_type &value)
 
bool pw::DynamicVector< T, SizeType >::try_assign (size_type count, const value_type &value)
 
void pw::DynamicVector< T, SizeType >::assign (std::initializer_list< T > init)
 
bool pw::DynamicVector< T, SizeType >::try_assign (std::initializer_list< T > init)
 
void pw::DynamicVector< T, SizeType >::push_back (const value_type &value)
 
void pw::DynamicVector< T, SizeType >::push_back (value_type &&value)
 
bool pw::DynamicVector< T, SizeType >::try_push_back (const value_type &value)
 
bool pw::DynamicVector< T, SizeType >::try_push_back (value_type &&value)
 
void pw::DynamicVector< T, SizeType >::pop_back ()
 
template<typename... Args>
void pw::DynamicVector< T, SizeType >::emplace_back (Args &&... args)
 
template<typename... Args>
bool pw::DynamicVector< T, SizeType >::try_emplace_back (Args &&... args)
 
template<typename... Args>
iterator pw::DynamicVector< T, SizeType >::emplace (const_iterator pos, Args &&... args)
 
template<typename... Args>
std::optional< iteratorpw::DynamicVector< T, SizeType >::try_emplace (const_iterator pos, Args &&... args)
 
iterator pw::DynamicVector< T, SizeType >::insert (const_iterator pos, const T &value)
 
iterator pw::DynamicVector< T, SizeType >::insert (const_iterator pos, T &&value)
 
iterator pw::DynamicVector< T, SizeType >::insert (const_iterator pos, size_type count, const T &value)
 
template<typename InputIt >
iterator pw::DynamicVector< T, SizeType >::insert (const_iterator pos, InputIt first, InputIt last)
 
iterator pw::DynamicVector< T, SizeType >::insert (const_iterator pos, std::initializer_list< T > ilist)
 
std::optional< iteratorpw::DynamicVector< T, SizeType >::try_insert (const_iterator pos, const T &value)
 
std::optional< iteratorpw::DynamicVector< T, SizeType >::try_insert (const_iterator pos, T &&value)
 
std::optional< iteratorpw::DynamicVector< T, SizeType >::try_insert (const_iterator pos, size_type count, const T &value)
 
template<typename InputIt >
std::optional< iteratorpw::DynamicVector< T, SizeType >::try_insert (const_iterator pos, InputIt first, InputIt last)
 
std::optional< iteratorpw::DynamicVector< T, SizeType >::try_insert (const_iterator pos, std::initializer_list< T > ilist)
 
iterator pw::DynamicVector< T, SizeType >::erase (const_iterator pos)
 
iterator pw::DynamicVector< T, SizeType >::erase (const_iterator first, const_iterator last)
 
void pw::DynamicVector< T, SizeType >::resize (size_type count)
 
void pw::DynamicVector< T, SizeType >::resize (size_type count, const value_type &value)
 
bool pw::DynamicVector< T, SizeType >::try_resize (size_type count)
 
bool pw::DynamicVector< T, SizeType >::try_resize (size_type count, const value_type &value)
 
void pw::DynamicVector< T, SizeType >::clear ()
 Removes all elements from the vector.
 
void pw::DynamicVector< T, SizeType >::swap (DynamicVector &other)
 

Function Documentation

◆ assign() [1/2]

template<typename T , typename SizeType = uint16_t>
void pw::DynamicVector< T, SizeType >::assign ( size_type  count,
const value_type &  value 
)
inline

Assigns new contents to the vector, replacing its current contents.

Parameters
countThe number of elements to assign.
valueThe value to copy.
Returns
true if successful, false otherwise.

◆ assign() [2/2]

template<typename T , typename SizeType = uint16_t>
void pw::DynamicVector< T, SizeType >::assign ( std::initializer_list< T >  init)
inline

Assigns new contents to the vector from an initializer list.

Parameters
initThe initializer list to copy elements from.
Returns
true if successful, false otherwise.

◆ at() [1/2]

template<typename T , typename SizeType = uint16_t>
reference pw::DynamicVector< T, SizeType >::at ( size_type  pos)
inline

Returns a reference to the element at specified location pos, with bounds checking.

Crashes if pos is not within the range [0, size()).

Parameters
posThe index of the element to access.
Returns
Reference to the element.

◆ at() [2/2]

template<typename T , typename SizeType = uint16_t>
const_reference pw::DynamicVector< T, SizeType >::at ( size_type  pos) const
inline

Returns a const reference to the element at specified location pos, with bounds checking.

Crashes if pos is not within the range [0, size()).

Parameters
posThe index of the element to access.
Returns
Const reference to the element.

◆ back() [1/2]

template<typename T , typename SizeType = uint16_t>
reference pw::DynamicVector< T, SizeType >::back ( )
inline

Returns a reference to the last element in the vector.

Calling back() on an empty vector is undefined behavior.

◆ back() [2/2]

template<typename T , typename SizeType = uint16_t>
const_reference pw::DynamicVector< T, SizeType >::back ( ) const
inline

Returns a const reference to the last element in the vector.

Calling back() on an empty vector is undefined behavior.

◆ capacity()

template<typename T , typename SizeType = uint16_t>
size_type pw::DynamicVector< T, SizeType >::capacity ( ) const
inline

Returns the total number of elements that the vector can hold without requiring reallocation.

◆ data() [1/2]

template<typename T , typename SizeType = uint16_t>
pointer pw::DynamicVector< T, SizeType >::data ( )
inline

Returns a pointer to the underlying array serving as element storage.

The pointer is such that [data(), data() + size()) is a valid range.

Returns
A pointer to the first element, or nullptr if the vector is empty.

◆ data() [2/2]

template<typename T , typename SizeType = uint16_t>
const_pointer pw::DynamicVector< T, SizeType >::data ( ) const
inline

Returns a const pointer to the underlying array serving as element storage.

Returns
A const pointer to the first element, or nullptr if the vector is empty.

◆ DynamicVector()

template<typename T , typename SizeType = uint16_t>
constexpr pw::DynamicVector< T, SizeType >::DynamicVector ( Allocator allocator)
inlineexplicitconstexpr

Constructs an empty DynamicVector using the provided allocator.

Parameters
allocatorThe allocator to use for memory management.

◆ emplace()

template<typename T , typename SizeType = uint16_t>
template<typename... Args>
iterator pw::DynamicVector< T, SizeType >::emplace ( const_iterator  pos,
Args &&...  args 
)
inline

Constructs an element in-place at the specified position.

Crashes if allocation fails.

Parameters
posThe position at which to construct the element.
argsArguments to forward to the element's constructor.
Returns
Iterator to the emplaced element.

◆ emplace_back()

template<typename T , typename SizeType = uint16_t>
template<typename... Args>
void pw::DynamicVector< T, SizeType >::emplace_back ( Args &&...  args)
inline

Constructs an element in place at the back of the vector.

Note: This operation is potentially fallible if memory allocation is required and fails. Use try_emplace_back() for a fallible version.

◆ erase() [1/2]

template<typename T , typename SizeType = uint16_t>
iterator pw::DynamicVector< T, SizeType >::erase ( const_iterator  first,
const_iterator  last 
)
inline

Erases the specified range of elements from the vector.

Parameters
firstThe first element to erase.
lastThe last element to erase.
Returns
Iterator following the last removed element.

◆ erase() [2/2]

template<typename T , typename SizeType = uint16_t>
iterator pw::DynamicVector< T, SizeType >::erase ( const_iterator  pos)
inline

Erases the specified element from the vector.

Parameters
posIterator to the element to remove.
Returns
Iterator following the last removed element.

◆ front() [1/2]

template<typename T , typename SizeType = uint16_t>
reference pw::DynamicVector< T, SizeType >::front ( )
inline

Returns a reference to the first element in the vector.

Calling front() on an empty vector is undefined behavior.

◆ front() [2/2]

template<typename T , typename SizeType = uint16_t>
const_reference pw::DynamicVector< T, SizeType >::front ( ) const
inline

Returns a const reference to the first element in the vector.

Calling front() on an empty vector is undefined behavior.

◆ insert() [1/5]

template<typename T , typename SizeType = uint16_t>
iterator pw::DynamicVector< T, SizeType >::insert ( const_iterator  pos,
const T &  value 
)
inline

Inserts an element at the specified position.

Crashes if allocation fails.

Parameters
posThe position at which to insert the element.
valueThe value to insert.
Returns
Iterator to the inserted element.

◆ insert() [2/5]

template<typename T , typename SizeType = uint16_t>
template<typename InputIt >
iterator pw::DynamicVector< T, SizeType >::insert ( const_iterator  pos,
InputIt  first,
InputIt  last 
)
inline

Inserts elements from an iterator range at the specified position.

Crashes if allocation fails.

Parameters
posThe position at which to insert the elements.
firstThe beginning of the range to insert.
lastThe end of the range to insert.
Returns
Iterator to the first inserted element.

◆ insert() [3/5]

template<typename T , typename SizeType = uint16_t>
iterator pw::DynamicVector< T, SizeType >::insert ( const_iterator  pos,
size_type  count,
const T &  value 
)
inline

Inserts multiple copies of an element at the specified position.

Crashes if allocation fails.

Parameters
posThe position at which to insert the elements.
countThe number of elements to insert.
valueThe value to insert.
Returns
Iterator to the first inserted element.

◆ insert() [4/5]

template<typename T , typename SizeType = uint16_t>
iterator pw::DynamicVector< T, SizeType >::insert ( const_iterator  pos,
std::initializer_list< T >  ilist 
)
inline

Inserts elements from an initializer list at the specified position.

Crashes if allocation fails.

Parameters
posThe position at which to insert the elements.
ilistThe initializer list to insert.
Returns
Iterator to the first inserted element.

◆ insert() [5/5]

template<typename T , typename SizeType = uint16_t>
iterator pw::DynamicVector< T, SizeType >::insert ( const_iterator  pos,
T &&  value 
)
inline

Inserts an element at the specified position (move version).

Crashes if allocation fails.

Parameters
posThe position at which to insert the element.
valueThe value to insert.
Returns
Iterator to the inserted element.

◆ operator[]() [1/2]

template<typename T , typename SizeType = uint16_t>
reference pw::DynamicVector< T, SizeType >::operator[] ( size_type  pos)
inline

Returns a reference to the element at specified location pos.

No bounds checking is performed.

Parameters
posThe index of the element to access.
Returns
Reference to the element.

◆ operator[]() [2/2]

template<typename T , typename SizeType = uint16_t>
const_reference pw::DynamicVector< T, SizeType >::operator[] ( size_type  pos) const
inline

Returns a const reference to the element at specified location pos.

No bounds checking is performed.

Parameters
posThe index of the element to access.
Returns
Const reference to the element.

◆ pop_back()

template<typename T , typename SizeType = uint16_t>
void pw::DynamicVector< T, SizeType >::pop_back ( )
inline

Removes the last element from the vector.

Calling pop_back() on an empty vector is undefined behavior.

◆ push_back() [1/2]

template<typename T , typename SizeType = uint16_t>
void pw::DynamicVector< T, SizeType >::push_back ( const value_type &  value)
inline

Adds an element to the back of the vector.

Note: This operation is potentially fallible if memory allocation is required and fails. Use try_push_back() for a fallible version.

◆ push_back() [2/2]

template<typename T , typename SizeType = uint16_t>
void pw::DynamicVector< T, SizeType >::push_back ( value_type &&  value)
inline

Adds an element to the back of the vector (move version).

Note: This operation is potentially fallible if memory allocation is required and fails.

◆ reserve()

template<typename T , typename SizeType = uint16_t>
void pw::DynamicVector< T, SizeType >::reserve ( size_type  new_capacity)
inline

Requests that the vector capacity be at least new_capacity elements.

Crashes if allocation fails.

Parameters
new_capacityThe minimum desired capacity.

◆ reserve_exact()

template<typename T , typename SizeType = uint16_t>
void pw::DynamicVector< T, SizeType >::reserve_exact ( size_type  new_capacity)
inline

Requests that the vector capacity be exactly new_capacity elements.

Crashes if allocation fails.

Parameters
new_capacityThe minimum desired capacity.

◆ resize() [1/2]

template<typename T , typename SizeType = uint16_t>
void pw::DynamicVector< T, SizeType >::resize ( size_type  count)
inline

Resizes the vector to contain count elements.

If count is smaller than the current size, the content is reduced to the first count elements. If count is greater than the current size, new elements are appended and default-constructed.

Parameters
countNew size of the vector.

◆ resize() [2/2]

template<typename T , typename SizeType = uint16_t>
void pw::DynamicVector< T, SizeType >::resize ( size_type  count,
const value_type &  value 
)
inline

Resizes the vector to contain count elements, value-initializing new elements.

If count is smaller than the current size, the content is reduced to the first count elements. If count is greater than the current size, new elements are appended and copy-constructed from value.

Parameters
countNew size of the vector.
valueValue to initialize new elements with.

◆ swap()

template<typename T , typename SizeType = uint16_t>
void pw::DynamicVector< T, SizeType >::swap ( DynamicVector< T, SizeType > &  other)
inline

Swaps the contents with another DynamicVector.

Parameters
otherThe other vector to swap with.

◆ try_emplace()

template<typename T , typename SizeType = uint16_t>
template<typename... Args>
std::optional< iterator > pw::DynamicVector< T, SizeType >::try_emplace ( const_iterator  pos,
Args &&...  args 
)
inline

Attempts to construct an element in-place at the specified position.

Returns an iterator to the new element on success, or std::nullopt if allocation fails.

Parameters
posThe position at which to construct the element.
argsArguments to forward to the element's constructor.
Returns
Iterator to the emplaced element, or std::nullopt on failure.

◆ try_emplace_back()

template<typename T , typename SizeType = uint16_t>
template<typename... Args>
bool pw::DynamicVector< T, SizeType >::try_emplace_back ( Args &&...  args)
inline

Attempts to construct an element in place at the back of the vector.

Returns true on success, or false if allocation fails.

Parameters
argsArguments to forward to the element's constructor.
Returns
true if successful, false otherwise.

◆ try_insert() [1/5]

template<typename T , typename SizeType = uint16_t>
std::optional< iterator > pw::DynamicVector< T, SizeType >::try_insert ( const_iterator  pos,
const T &  value 
)
inline

Attempts to insert an element at the specified position.

Returns an iterator to the new element on success, or std::nullopt if allocation fails.

Parameters
posThe position at which to insert the element.
valueThe value to insert.
Returns
Iterator to the inserted element, or std::nullopt on failure.

◆ try_insert() [2/5]

template<typename T , typename SizeType = uint16_t>
template<typename InputIt >
std::optional< iterator > pw::DynamicVector< T, SizeType >::try_insert ( const_iterator  pos,
InputIt  first,
InputIt  last 
)
inline

Attempts to insert elements from an iterator range at the specified position.

Returns an iterator to the first new element on success, or std::nullopt if allocation fails.

Parameters
posThe position at which to insert the elements.
firstThe beginning of the range to insert.
lastThe end of the range to insert.
Returns
Iterator to the first inserted element, or std::nullopt on failure.

◆ try_insert() [3/5]

template<typename T , typename SizeType = uint16_t>
std::optional< iterator > pw::DynamicVector< T, SizeType >::try_insert ( const_iterator  pos,
size_type  count,
const T &  value 
)
inline

Attempts to insert multiple copies of an element at the specified position.

Returns an iterator to the first new element on success, or std::nullopt if allocation fails.

Parameters
posThe position at which to insert the elements.
countThe number of elements to insert.
valueThe value to insert.
Returns
Iterator to the first inserted element, or std::nullopt on failure.

◆ try_insert() [4/5]

template<typename T , typename SizeType = uint16_t>
std::optional< iterator > pw::DynamicVector< T, SizeType >::try_insert ( const_iterator  pos,
std::initializer_list< T >  ilist 
)
inline

Attempts to insert elements from an initializer list at the specified position.

Returns an iterator to the first new element on success, or std::nullopt if allocation fails.

Parameters
posThe position at which to insert the elements.
ilistThe initializer list to insert.
Returns
Iterator to the first inserted element, or std::nullopt on failure.

◆ try_insert() [5/5]

template<typename T , typename SizeType = uint16_t>
std::optional< iterator > pw::DynamicVector< T, SizeType >::try_insert ( const_iterator  pos,
T &&  value 
)
inline

Attempts to insert an element at the specified position (move version).

Returns an iterator to the new element on success, or std::nullopt if allocation fails.

Parameters
posThe position at which to insert the element.
valueThe value to insert.
Returns
Iterator to the inserted element, or std::nullopt on failure.

◆ try_push_back() [1/2]

template<typename T , typename SizeType = uint16_t>
bool pw::DynamicVector< T, SizeType >::try_push_back ( const value_type &  value)
inline

Attempts to add an element to the back of the vector.

Returns true on success, or false if allocation fails.

Parameters
valueThe value to add.
Returns
true if successful, false otherwise.

◆ try_push_back() [2/2]

template<typename T , typename SizeType = uint16_t>
bool pw::DynamicVector< T, SizeType >::try_push_back ( value_type &&  value)
inline

Attempts to add an element to the back of the vector (move version).

Returns true on success, or false if allocation fails.

Parameters
valueThe value to add.
Returns
true if successful, false otherwise.

◆ try_reserve()

template<typename T , typename SizeType = uint16_t>
bool pw::DynamicVector< T, SizeType >::try_reserve ( size_type  new_capacity)
inline

Attempts to request that the vector capacity be at least new_capacity elements.

Returns true on success, or false if allocation fails.

Parameters
new_capacityThe minimum desired capacity.
Returns
true if successful, false otherwise.

◆ try_reserve_exact()

template<typename T , typename SizeType = uint16_t>
bool pw::DynamicVector< T, SizeType >::try_reserve_exact ( size_type  new_capacity)
inline

Attempts to set the vector capacity to exactly new_capacity elements.

Returns true on success, or false if allocation fails.

Parameters
new_capacityThe exact desired capacity.
Returns
true if successful, false otherwise.

◆ try_resize() [1/2]

template<typename T , typename SizeType = uint16_t>
bool pw::DynamicVector< T, SizeType >::try_resize ( size_type  count)
inline

Attempts to resize the vector to contain count elements.

Parameters
countNew size of the vector.
Returns
true if successful, false otherwise.

◆ try_resize() [2/2]

template<typename T , typename SizeType = uint16_t>
bool pw::DynamicVector< T, SizeType >::try_resize ( size_type  count,
const value_type &  value 
)
inline

Attempts to resize the vector to contain count elements, value-initializing new elements.

Parameters
countNew size of the vector.
valueValue to initialize new elements with.
Returns
true if successful, false otherwise.