|
iceoryx2
C++ Language Bindings
|
A class representing a slice of contiguous elements of type T. More...
#include <slice.hpp>
Public Types | |
| using | Iterator = T * |
| using | ConstIterator = const T * |
| using | ValueType = std::remove_const_t< T > |
Public Member Functions | |
| Slice (T *data, uint64_t number_of_elements) | |
| Constructs a Slice object. | |
| auto | number_of_bytes () const -> uint64_t |
| Returns the total number of bytes occupied by the slice. | |
| auto | number_of_elements () const -> uint64_t |
| Returns the number of elements in the slice. | |
| auto | operator[] (uint64_t n) const -> const ValueType & |
| Accesses the element at the specified index (const version). | |
| auto | operator[] (uint64_t n) -> std::conditional_t< std::is_const< T >::value, const ValueType &, ValueType & > |
| Accesses the element at the specified index (non-const version). | |
| auto | begin () const -> ConstIterator |
| Returns an iterator to the beginning of the slice (const version). | |
| auto | begin () -> Iterator |
| Returns an iterator to the beginning of the slice (non-const version). | |
| auto | end () const -> ConstIterator |
| Returns an iterator to the end of the slice (const version). | |
| auto | end () -> Iterator |
| Returns an iterator to the end of the slice (non-const version). | |
| auto | data () const -> ConstIterator |
| Returns a pointer to the underlying data of the slice (const version). | |
| auto | data () -> Iterator |
| Returns a pointer to the underlying data of the slice (non-const version). | |
A class representing a slice of contiguous elements of type T.
A Slice provides a view into a contiguous sequence of elements without owning the memory. It allows for efficient access and iteration over a portion of a contiguous data structure.
| T | The type of elements in the slice. Can be const-qualified for read-only slices. |
| using iox2::bb::Slice< T >::ConstIterator = const T* |
| using iox2::bb::Slice< T >::Iterator = T* |
| using iox2::bb::Slice< T >::ValueType = std::remove_const_t<T> |
| iox2::bb::Slice< T >::Slice | ( | T * | data, |
| uint64_t | number_of_elements | ||
| ) |
Constructs a Slice object.
| [in] | data | Pointer to the beginning of the data. |
| [in] | number_of_elements | The number of elements in the slice. |
Definition at line 98 of file slice.hpp.
References iox2::bb::Slice< T >::data().
| auto iox2::bb::Slice< T >::begin | ( | ) | -> Iterator |
| auto iox2::bb::Slice< T >::begin | ( | ) | const -> ConstIterator |
| auto iox2::bb::Slice< T >::data | ( | ) | -> Iterator |
| auto iox2::bb::Slice< T >::data | ( | ) | const -> ConstIterator |
Returns a pointer to the underlying data of the slice (const version).
Definition at line 153 of file slice.hpp.
Referenced by iox2::bb::Slice< T >::Slice().
| auto iox2::bb::Slice< T >::end | ( | ) | -> Iterator |
| auto iox2::bb::Slice< T >::end | ( | ) | const -> ConstIterator |
| auto iox2::bb::Slice< T >::number_of_bytes | ( | ) | const -> uint64_t |
| auto iox2::bb::Slice< T >::number_of_elements | ( | ) | const -> uint64_t |
| auto iox2::bb::Slice< T >::operator[] | ( | uint64_t | n | ) | -> std::conditional_t<std::is_const<T>::value, const ValueType&, ValueType&> |
Accesses the element at the specified index (non-const version).
| [in] | n | The index of the element to access. |
Definition at line 121 of file slice.hpp.
References IOX2_ASSERT.
| auto iox2::bb::Slice< T >::operator[] | ( | uint64_t | n | ) | const -> const ValueType& |
Accesses the element at the specified index (const version).
| [in] | n | The index of the element to access. |
Definition at line 115 of file slice.hpp.
References IOX2_ASSERT.