iceoryx2
C++ Language Bindings
Loading...
Searching...
No Matches
iox2::bb::StaticVector< T, Capacity > Class Template Reference

A resizable container with compile-time fixed static capacity and contiguous inplace storage. More...

#include <static_vector.hpp>

Classes

class  UncheckedAccessor
 Users of this class must ensure that all memory accesses stay within bounds of the accessed vector's memory. More...
 
class  UncheckedConstAccessor
 

Public Types

using ValueType = T
 
using SizeType = size_t
 
using DifferenceType = ptrdiff_t
 
using Reference = T &
 
using ConstReference = T const &
 
using Pointer = T *
 
using ConstPointer = T const *
 
using Iterator = Pointer
 
using ConstIterator = ConstPointer
 
using OptionalReference = bb::Optional< std::reference_wrapper< T > >
 
using OptionalConstReference = bb::Optional< std::reference_wrapper< T const > >
 

Public Member Functions

constexpr StaticVector () noexcept=default
 
constexpr StaticVector (StaticVector const &)=default
 
constexpr StaticVector (StaticVector &&)=default
 
template<uint64_t M, std::enable_if_t<(Capacity >=M), bool > = true>
constexpr StaticVector (StaticVector< T, M > const &rhs)
 Copy construct from a vector with smaller capacity.
 
template<uint64_t M, std::enable_if_t<(Capacity >=M), bool > = true>
constexpr StaticVector (T const (&element_array)[M])
 Construct from a C-style array.
 
IOX2_CONSTEXPR_DTOR ~StaticVector ()=default
 
auto operator= (StaticVector const &) -> StaticVector &=default
 
auto operator= (StaticVector &&) -> StaticVector &=default
 
template<typename... Args, std::enable_if_t< std::is_constructible< T, Args... >::value, bool > = true>
constexpr auto try_emplace_back (Args &&... args) -> bool
 
template<typename... Args, std::enable_if_t< std::is_constructible< T, Args... >::value, bool > = true>
constexpr auto try_emplace_at (SizeType index, Args &&... args) -> bool
 
constexpr auto try_erase_at (SizeType index) -> bool
 
constexpr auto try_erase_at (SizeType begin_index, SizeType end_index) -> bool
 
constexpr auto try_insert_at (SizeType index, T const &value) -> bool
 
constexpr auto try_insert_at (SizeType index, T &&value) -> bool
 
constexpr auto try_insert_at (SizeType index, SizeType count, T const &value) -> bool
 
template<typename Iter , typename Sentinel , std::enable_if_t< std::is_constructible< T, decltype(*std::declval< Iter >())>::value &&std::is_convertible< decltype(std::declval< Iter >()==std::declval< Sentinel >()), bool >::value , bool >
constexpr auto try_insert_at_unchecked (SizeType index, Iter it_begin, Sentinel it_end) -> bool
 
constexpr auto try_insert_at_unchecked (SizeType index, std::initializer_list< T > init_list)
 
constexpr void clear ()
 
constexpr auto try_push_back (T const &value) -> bool
 
constexpr auto try_push_back (T &&value) -> bool
 
constexpr auto try_pop_back () -> bool
 
constexpr auto size () const noexcept -> SizeType
 Retrieves the size of the vector.
 
constexpr auto empty () const -> bool
 Checks whether the vector is currently empty.
 
auto element_at (SizeType index) -> OptionalReference
 
auto element_at (SizeType index) const -> OptionalConstReference
 
auto front_element () -> OptionalReference
 
auto front_element () const -> OptionalConstReference
 
auto back_element () -> OptionalReference
 
auto back_element () const -> OptionalConstReference
 
auto unchecked_access () -> UncheckedAccessor
 Unchecked mutable access to the vector contents.
 
auto unchecked_access () const -> UncheckedConstAccessor
 Unchecked immutable access to the vector contents.
 
constexpr auto static_memory_layout_metrics () noexcept
 

Static Public Member Functions

template<uint64_t N>
static constexpr auto from_value (const T &value) -> StaticVector
 
template<typename U = T, std::enable_if_t< std::is_default_constructible< U >::value, bool > = true>
static constexpr auto from_value (SizeType count) -> bb::Optional< StaticVector >
 
static constexpr auto from_value (SizeType count, T const &value) -> bb::Optional< StaticVector >
 Construct a new vector with count copies of value.
 
template<typename Iter , typename Sentinel , std::enable_if_t< std::is_constructible< T, decltype(*std::declval< Iter >())>::value &&std::is_convertible< decltype(std::declval< Iter >()==std::declval< Sentinel >()), bool >::value , bool >
static constexpr auto from_range_unchecked (Iter it_begin, Sentinel it_end) -> bb::Optional< StaticVector >
 
template<typename Range >
static constexpr auto from_range_unchecked (Range const &rng) -> bb::Optional< StaticVector >
 
static constexpr auto from_initializer_list (std::initializer_list< T > init_list) -> bb::Optional< StaticVector >
 
static constexpr auto capacity () noexcept -> SizeType
 Retrieves the static capacity of the vector.
 

Friends

template<typename , uint64_t >
class StaticVector
 
auto operator== (StaticVector const &lhs, StaticVector const &rhs) -> bool
 
auto operator!= (StaticVector const &lhs, StaticVector const &rhs) -> bool
 

Detailed Description

template<typename T, uint64_t Capacity>
class iox2::bb::StaticVector< T, Capacity >

A resizable container with compile-time fixed static capacity and contiguous inplace storage.

Definition at line 35 of file static_vector.hpp.

Member Typedef Documentation

◆ ConstIterator

template<typename T , uint64_t Capacity>
using iox2::bb::StaticVector< T, Capacity >::ConstIterator = ConstPointer

Definition at line 48 of file static_vector.hpp.

◆ ConstPointer

template<typename T , uint64_t Capacity>
using iox2::bb::StaticVector< T, Capacity >::ConstPointer = T const*

Definition at line 46 of file static_vector.hpp.

◆ ConstReference

template<typename T , uint64_t Capacity>
using iox2::bb::StaticVector< T, Capacity >::ConstReference = T const&

Definition at line 44 of file static_vector.hpp.

◆ DifferenceType

template<typename T , uint64_t Capacity>
using iox2::bb::StaticVector< T, Capacity >::DifferenceType = ptrdiff_t

Definition at line 42 of file static_vector.hpp.

◆ Iterator

template<typename T , uint64_t Capacity>
using iox2::bb::StaticVector< T, Capacity >::Iterator = Pointer

Definition at line 47 of file static_vector.hpp.

◆ OptionalConstReference

template<typename T , uint64_t Capacity>
using iox2::bb::StaticVector< T, Capacity >::OptionalConstReference = bb::Optional<std::reference_wrapper<T const> >

Definition at line 50 of file static_vector.hpp.

◆ OptionalReference

template<typename T , uint64_t Capacity>
using iox2::bb::StaticVector< T, Capacity >::OptionalReference = bb::Optional<std::reference_wrapper<T> >

Definition at line 49 of file static_vector.hpp.

◆ Pointer

template<typename T , uint64_t Capacity>
using iox2::bb::StaticVector< T, Capacity >::Pointer = T*

Definition at line 45 of file static_vector.hpp.

◆ Reference

template<typename T , uint64_t Capacity>
using iox2::bb::StaticVector< T, Capacity >::Reference = T&

Definition at line 43 of file static_vector.hpp.

◆ SizeType

template<typename T , uint64_t Capacity>
using iox2::bb::StaticVector< T, Capacity >::SizeType = size_t

Definition at line 41 of file static_vector.hpp.

◆ ValueType

template<typename T , uint64_t Capacity>
using iox2::bb::StaticVector< T, Capacity >::ValueType = T

Definition at line 40 of file static_vector.hpp.

Constructor & Destructor Documentation

◆ StaticVector() [1/5]

template<typename T , uint64_t Capacity>
constexpr iox2::bb::StaticVector< T, Capacity >::StaticVector ( )
constexprdefaultnoexcept

◆ StaticVector() [2/5]

template<typename T , uint64_t Capacity>
constexpr iox2::bb::StaticVector< T, Capacity >::StaticVector ( StaticVector< T, Capacity > const &  )
constexprdefault

◆ StaticVector() [3/5]

template<typename T , uint64_t Capacity>
constexpr iox2::bb::StaticVector< T, Capacity >::StaticVector ( StaticVector< T, Capacity > &&  )
constexprdefault

◆ StaticVector() [4/5]

template<typename T , uint64_t Capacity>
template<uint64_t M, std::enable_if_t<(Capacity >=M), bool > = true>
constexpr iox2::bb::StaticVector< T, Capacity >::StaticVector ( StaticVector< T, M > const &  rhs)
inlineconstexpr

Copy construct from a vector with smaller capacity.

Definition at line 141 of file static_vector.hpp.

◆ StaticVector() [5/5]

template<typename T , uint64_t Capacity>
template<uint64_t M, std::enable_if_t<(Capacity >=M), bool > = true>
constexpr iox2::bb::StaticVector< T, Capacity >::StaticVector ( T const (&)  element_array[M])
inlineexplicitconstexpr

Construct from a C-style array.

Definition at line 148 of file static_vector.hpp.

References iox2::bb::StaticVector< T, Capacity >::try_push_back().

◆ ~StaticVector()

template<typename T , uint64_t Capacity>
IOX2_CONSTEXPR_DTOR iox2::bb::StaticVector< T, Capacity >::~StaticVector ( )
default

Member Function Documentation

◆ back_element() [1/2]

template<typename T , uint64_t Capacity>
auto iox2::bb::StaticVector< T, Capacity >::back_element ( ) -> OptionalReference
inline

Attempts to retrieve the last element.

Returns
Nullopt if size() == 0. Otherwise a reference to the last element.

Definition at line 451 of file static_vector.hpp.

References iox2::bb::StaticVector< T, Capacity >::empty(), iox2::bb::NULLOPT, iox2::bb::detail::RawByteStorage< T, Capacity >::pointer_from_index(), and iox2::bb::StaticVector< T, Capacity >::size().

◆ back_element() [2/2]

template<typename T , uint64_t Capacity>
auto iox2::bb::StaticVector< T, Capacity >::back_element ( ) const -> OptionalConstReference
inline

Attempts to retrieve the last element.

Returns
Nullopt if size() == 0. Otherwise a reference to the last element.

Definition at line 462 of file static_vector.hpp.

References iox2::bb::StaticVector< T, Capacity >::empty(), iox2::bb::NULLOPT, iox2::bb::detail::RawByteStorage< T, Capacity >::pointer_from_index(), and iox2::bb::StaticVector< T, Capacity >::size().

◆ capacity()

template<typename T , uint64_t Capacity>
static constexpr auto iox2::bb::StaticVector< T, Capacity >::capacity ( ) -> SizeType
inlinestaticconstexprnoexcept

Retrieves the static capacity of the vector.

Definition at line 390 of file static_vector.hpp.

◆ clear()

template<typename T , uint64_t Capacity>
constexpr void iox2::bb::StaticVector< T, Capacity >::clear ( )
inlineconstexpr

Clears all elements from the vector. After this operation, the vector will be empty.

Definition at line 357 of file static_vector.hpp.

References iox2::bb::detail::RawByteStorage< T, Capacity >::erase_at(), and iox2::bb::detail::RawByteStorage< T, Capacity >::size().

◆ element_at() [1/2]

template<typename T , uint64_t Capacity>
auto iox2::bb::StaticVector< T, Capacity >::element_at ( SizeType  index) -> OptionalReference
inline

Attempts to retrieve the element at index.

Returns
Nullopt if index is not 0 <= index < size(). Otherwise a reference to the element at the requested index.

Definition at line 407 of file static_vector.hpp.

References iox2::bb::NULLOPT, iox2::bb::detail::RawByteStorage< T, Capacity >::pointer_from_index(), and iox2::bb::detail::RawByteStorage< T, Capacity >::size().

◆ element_at() [2/2]

template<typename T , uint64_t Capacity>
auto iox2::bb::StaticVector< T, Capacity >::element_at ( SizeType  index) const -> OptionalConstReference
inline

Attempts to retrieve the element at index.

Returns
Nullopt if index is not 0 <= index < size(). Otherwise a reference to the element at the requested index.

Definition at line 418 of file static_vector.hpp.

References iox2::bb::NULLOPT, iox2::bb::detail::RawByteStorage< T, Capacity >::pointer_from_index(), and iox2::bb::detail::RawByteStorage< T, Capacity >::size().

◆ empty()

template<typename T , uint64_t Capacity>
constexpr auto iox2::bb::StaticVector< T, Capacity >::empty ( ) const -> bool
inlineconstexpr

◆ from_initializer_list()

template<typename T , uint64_t Capacity>
static constexpr auto iox2::bb::StaticVector< T, Capacity >::from_initializer_list ( std::initializer_list< T >  init_list) -> bb::Optional<StaticVector>
inlinestaticconstexpr

Constructs a vector from the elements of the initializer list init_list.

Returns
Nullopt if the initializer list size exceeds the vector capacity. Otherwise a vector containing copies of the list elements.

Definition at line 232 of file static_vector.hpp.

References iox2::bb::StaticVector< T, Capacity >::from_range_unchecked(), and iox2::bb::NULLOPT.

◆ from_range_unchecked() [1/2]

template<typename T , uint64_t Capacity>
template<typename Iter , typename Sentinel , std::enable_if_t< std::is_constructible< T, decltype(*std::declval< Iter >())>::value &&std::is_convertible< decltype(std::declval< Iter >()==std::declval< Sentinel >()), bool >::value , bool >
static constexpr auto iox2::bb::StaticVector< T, Capacity >::from_range_unchecked ( Iter  it_begin,
Sentinel  it_end 
) -> bb::Optional<StaticVector>
inlinestaticconstexpr

Construct a vector from a range [it_begin, it_end). Users must ensure that it_end is reachable from it_begin without causing undefined behaviour.

Returns
Nullopt if the range size exceeds the vector capacity. Otherwise a vector containing copies of the range elements.

Definition at line 205 of file static_vector.hpp.

References iox2::bb::NULLOPT.

Referenced by iox2::bb::StaticVector< T, Capacity >::from_initializer_list(), iox2::bb::StaticVector< T, Capacity >::from_range_unchecked(), iox2::BackpressureInfo::receiver_port_id(), iox2::DegradationInfo::receiver_port_id(), iox2::BackpressureInfo::sender_port_id(), iox2::DegradationInfo::sender_port_id(), iox2::BackpressureInfo::service_id(), and iox2::DegradationInfo::service_id().

◆ from_range_unchecked() [2/2]

template<typename T , uint64_t Capacity>
template<typename Range >
static constexpr auto iox2::bb::StaticVector< T, Capacity >::from_range_unchecked ( Range const &  rng) -> bb::Optional<StaticVector>
inlinestaticconstexpr

Constructs a vector from a range [begin(rng), end(rng)). Users must ensure that rng is represents a valid range object.

Returns
Nullopt if the range size exceeds the vector capacity. Otherwise a vector containing copies of the range elements.

Definition at line 222 of file static_vector.hpp.

References iox2::bb::StaticVector< T, Capacity >::from_range_unchecked().

◆ from_value() [1/3]

template<typename T , uint64_t Capacity>
template<uint64_t N>
static constexpr auto iox2::bb::StaticVector< T, Capacity >::from_value ( const T &  value) -> StaticVector
inlinestaticconstexpr

◆ from_value() [2/3]

template<typename T , uint64_t Capacity>
template<typename U = T, std::enable_if_t< std::is_default_constructible< U >::value, bool > = true>
static constexpr auto iox2::bb::StaticVector< T, Capacity >::from_value ( SizeType  count) -> bb::Optional<StaticVector>
inlinestaticconstexpr

Construct a new vector with count occurrences of a default constructed value.

Returns
Nullopt if count exceeds the vector capacity. Otherwise a vector containing the desired elements.

Definition at line 174 of file static_vector.hpp.

References iox2::bb::StaticVector< T, Capacity >::from_value(), and iox2::bb::NULLOPT.

◆ from_value() [3/3]

template<typename T , uint64_t Capacity>
static constexpr auto iox2::bb::StaticVector< T, Capacity >::from_value ( SizeType  count,
T const &  value 
) -> bb::Optional<StaticVector>
inlinestaticconstexpr

Construct a new vector with count copies of value.

Definition at line 183 of file static_vector.hpp.

References iox2::bb::detail::RawByteStorage< T, Capacity >::insert_at(), and iox2::bb::NULLOPT.

◆ front_element() [1/2]

template<typename T , uint64_t Capacity>
auto iox2::bb::StaticVector< T, Capacity >::front_element ( ) -> OptionalReference
inline

Attempts to retrieve the first element.

Returns
Nullopt if size() == 0. Otherwise a reference to the first element.

Definition at line 429 of file static_vector.hpp.

References iox2::bb::StaticVector< T, Capacity >::empty(), iox2::bb::NULLOPT, and iox2::bb::detail::RawByteStorage< T, Capacity >::pointer_from_index().

◆ front_element() [2/2]

template<typename T , uint64_t Capacity>
auto iox2::bb::StaticVector< T, Capacity >::front_element ( ) const -> OptionalConstReference
inline

Attempts to retrieve the first element.

Returns
Nullopt if size() == 0. Otherwise a reference to the first element.

Definition at line 440 of file static_vector.hpp.

References iox2::bb::StaticVector< T, Capacity >::empty(), iox2::bb::NULLOPT, and iox2::bb::detail::RawByteStorage< T, Capacity >::pointer_from_index().

◆ operator=() [1/2]

template<typename T , uint64_t Capacity>
auto iox2::bb::StaticVector< T, Capacity >::operator= ( StaticVector< T, Capacity > &&  ) -> StaticVector &=default
default

◆ operator=() [2/2]

template<typename T , uint64_t Capacity>
auto iox2::bb::StaticVector< T, Capacity >::operator= ( StaticVector< T, Capacity > const &  ) -> StaticVector &=default
default

◆ size()

template<typename T , uint64_t Capacity>
constexpr auto iox2::bb::StaticVector< T, Capacity >::size ( ) const -> SizeType
inlineconstexprnoexcept

◆ static_memory_layout_metrics()

template<typename T , uint64_t Capacity>
constexpr auto iox2::bb::StaticVector< T, Capacity >::static_memory_layout_metrics ( )
inlineconstexprnoexcept

Obtains metrics about the internal memory layout of the vector. This function is intended for internal use only.

Definition at line 494 of file static_vector.hpp.

References iox2::bb::detail::RawByteStorage< T, Capacity >::static_memory_layout_metrics().

◆ try_emplace_at()

template<typename T , uint64_t Capacity>
template<typename... Args, std::enable_if_t< std::is_constructible< T, Args... >::value, bool > = true>
constexpr auto iox2::bb::StaticVector< T, Capacity >::try_emplace_at ( SizeType  index,
Args &&...  args 
) -> bool
inlineconstexpr

Attempts to construct a new element from the constructor arguments args at the specified index.

Returns
true on success. false if index is greater than the current size of the vector or if the operation would exceed the vector's capacity.

Definition at line 258 of file static_vector.hpp.

References iox2::bb::detail::RawByteStorage< T, Capacity >::emplace_at(), and iox2::bb::detail::RawByteStorage< T, Capacity >::size().

Referenced by iox2::bb::StaticVector< T, Capacity >::try_insert_at(), and iox2::bb::StaticVector< T, Capacity >::try_insert_at().

◆ try_emplace_back()

template<typename T , uint64_t Capacity>
template<typename... Args, std::enable_if_t< std::is_constructible< T, Args... >::value, bool > = true>
constexpr auto iox2::bb::StaticVector< T, Capacity >::try_emplace_back ( Args &&...  args) -> bool
inlineconstexpr

Attempts to construct a new element from the constructor arguments args at the back of the vector.

Returns
true on success. false if the operation would exceed the vector's capacity.

Definition at line 244 of file static_vector.hpp.

References iox2::bb::detail::RawByteStorage< T, Capacity >::emplace_back(), and iox2::bb::detail::RawByteStorage< T, Capacity >::size().

Referenced by iox2::bb::StaticVector< T, Capacity >::try_push_back(), and iox2::bb::StaticVector< T, Capacity >::try_push_back().

◆ try_erase_at() [1/2]

template<typename T , uint64_t Capacity>
constexpr auto iox2::bb::StaticVector< T, Capacity >::try_erase_at ( SizeType  begin_index,
SizeType  end_index 
) -> bool
inlineconstexpr

Attempts to erase all elements in the index range [begin_index, end_index).

Returns
true on success. false if the index range is not a valid range of element indices.

Definition at line 282 of file static_vector.hpp.

References iox2::bb::detail::RawByteStorage< T, Capacity >::erase_at(), and iox2::bb::detail::RawByteStorage< T, Capacity >::size().

◆ try_erase_at() [2/2]

template<typename T , uint64_t Capacity>
constexpr auto iox2::bb::StaticVector< T, Capacity >::try_erase_at ( SizeType  index) -> bool
inlineconstexpr

Attempts to erase the element at the specified index.

Returns
true on success. false if index is not the index of an existing element.

Definition at line 270 of file static_vector.hpp.

References iox2::bb::detail::RawByteStorage< T, Capacity >::erase_at(), and iox2::bb::detail::RawByteStorage< T, Capacity >::size().

◆ try_insert_at() [1/3]

template<typename T , uint64_t Capacity>
constexpr auto iox2::bb::StaticVector< T, Capacity >::try_insert_at ( SizeType  index,
SizeType  count,
T const &  value 
) -> bool
inlineconstexpr

Attempts to insert count copies of value at index.

Returns
true on success. false if index is greater than the current size of the vector or if the operation would exceed the vector's capacity.

Definition at line 311 of file static_vector.hpp.

References iox2::bb::detail::RawByteStorage< T, Capacity >::insert_at(), and iox2::bb::detail::RawByteStorage< T, Capacity >::size().

◆ try_insert_at() [2/3]

template<typename T , uint64_t Capacity>
constexpr auto iox2::bb::StaticVector< T, Capacity >::try_insert_at ( SizeType  index,
T &&  value 
) -> bool
inlineconstexpr

Attempts to insert a single value at index. This function will move the input value into place.

Returns
true on success. false if index is greater than the current size of the vector.

Definition at line 303 of file static_vector.hpp.

References iox2::bb::StaticVector< T, Capacity >::try_emplace_at().

◆ try_insert_at() [3/3]

template<typename T , uint64_t Capacity>
constexpr auto iox2::bb::StaticVector< T, Capacity >::try_insert_at ( SizeType  index,
T const &  value 
) -> bool
inlineconstexpr

Attempts to insert a single value at index. This function will copy the input value into place.

Returns
true on success. false if index is greater than the current size of the vector.

Definition at line 295 of file static_vector.hpp.

References iox2::bb::StaticVector< T, Capacity >::try_emplace_at().

◆ try_insert_at_unchecked() [1/2]

template<typename T , uint64_t Capacity>
template<typename Iter , typename Sentinel , std::enable_if_t< std::is_constructible< T, decltype(*std::declval< Iter >())>::value &&std::is_convertible< decltype(std::declval< Iter >()==std::declval< Sentinel >()), bool >::value , bool >
constexpr auto iox2::bb::StaticVector< T, Capacity >::try_insert_at_unchecked ( SizeType  index,
Iter  it_begin,
Sentinel  it_end 
) -> bool
inlineconstexpr

Attempts to insert the elements from the range [it_begin, it_end) at index. Users must ensure that it_end is reachable from it_begin without causing undefined behaviour.

Returns
true on success. false if index is greater than the current size of the vector or if the operation would exceed the vector's capacity.

Definition at line 331 of file static_vector.hpp.

References iox2::bb::detail::RawByteStorage< T, Capacity >::rotate_from_back(), iox2::bb::detail::RawByteStorage< T, Capacity >::shrink_from_back(), iox2::bb::StaticVector< T, Capacity >::size(), iox2::bb::detail::RawByteStorage< T, Capacity >::size(), and iox2::bb::StaticVector< T, Capacity >::try_push_back().

Referenced by iox2::bb::StaticVector< T, Capacity >::try_insert_at_unchecked().

◆ try_insert_at_unchecked() [2/2]

template<typename T , uint64_t Capacity>
constexpr auto iox2::bb::StaticVector< T, Capacity >::try_insert_at_unchecked ( SizeType  index,
std::initializer_list< T >  init_list 
)
inlineconstexpr

Attempts to insert the elements from the initializer list init_list at index.

Returns
true on success. false if index is greater than the current size of the vector or if the operation would exceed the vector's capacity.

Definition at line 351 of file static_vector.hpp.

References iox2::bb::StaticVector< T, Capacity >::try_insert_at_unchecked().

◆ try_pop_back()

template<typename T , uint64_t Capacity>
constexpr auto iox2::bb::StaticVector< T, Capacity >::try_pop_back ( ) -> bool
inlineconstexpr

Attempts to remove a single value from the back of the vector.

Returns
true on success. false if the vector is empty.

Definition at line 380 of file static_vector.hpp.

References iox2::bb::detail::RawByteStorage< T, Capacity >::shrink_from_back(), and iox2::bb::detail::RawByteStorage< T, Capacity >::size().

◆ try_push_back() [1/2]

template<typename T , uint64_t Capacity>
constexpr auto iox2::bb::StaticVector< T, Capacity >::try_push_back ( T &&  value) -> bool
inlineconstexpr

Attempts to insert a single value at the back of the vector. This function will move the input value into place.

Returns
true on success. false if index is greater than the current size of the vector.

Definition at line 373 of file static_vector.hpp.

References iox2::bb::StaticVector< T, Capacity >::try_emplace_back().

◆ try_push_back() [2/2]

template<typename T , uint64_t Capacity>
constexpr auto iox2::bb::StaticVector< T, Capacity >::try_push_back ( T const &  value) -> bool
inlineconstexpr

Attempts to insert a single value at the back of the vector. This function will copy the input value into place.

Returns
true on success. false if index is greater than the current size of the vector.

Definition at line 365 of file static_vector.hpp.

References iox2::bb::StaticVector< T, Capacity >::try_emplace_back().

Referenced by iox2::bb::StaticVector< T, Capacity >::StaticVector(), and iox2::bb::StaticVector< T, Capacity >::try_insert_at_unchecked().

◆ unchecked_access() [1/2]

template<typename T , uint64_t Capacity>
auto iox2::bb::StaticVector< T, Capacity >::unchecked_access ( ) -> UncheckedAccessor
inline

Unchecked mutable access to the vector contents.

Definition at line 471 of file static_vector.hpp.

◆ unchecked_access() [2/2]

template<typename T , uint64_t Capacity>
auto iox2::bb::StaticVector< T, Capacity >::unchecked_access ( ) const -> UncheckedConstAccessor
inline

Unchecked immutable access to the vector contents.

Definition at line 476 of file static_vector.hpp.

Friends And Related Symbol Documentation

◆ operator!=

template<typename T , uint64_t Capacity>
auto operator!= ( StaticVector< T, Capacity > const &  lhs,
StaticVector< T, Capacity > const &  rhs 
) -> bool
friend

Definition at line 488 of file static_vector.hpp.

◆ operator==

template<typename T , uint64_t Capacity>
auto operator== ( StaticVector< T, Capacity > const &  lhs,
StaticVector< T, Capacity > const &  rhs 
) -> bool
friend

Definition at line 481 of file static_vector.hpp.

◆ StaticVector

template<typename T , uint64_t Capacity>
template<typename , uint64_t >
friend class StaticVector
friend

Definition at line 128 of file static_vector.hpp.


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