13#ifndef IOX2_BB_SLICE_HPP
14#define IOX2_BB_SLICE_HPP
54 auto operator[](uint64_t n) const -> const
ValueType&;
60 auto operator[](uint64_t n) -> std::conditional_t<std::is_const<T>::value, const
ValueType&,
ValueType&>;
88 uint64_t m_number_of_elements;
101 static_assert(!std::is_same<T, void>::value,
"Slice<void> is not allowed");
111 return m_number_of_elements;
116 IOX2_ASSERT(n < m_number_of_elements,
"Index out of bounds");
117 return *(m_data + n);
123 IOX2_ASSERT(n < m_number_of_elements,
"Index out of bounds");
124 return *(m_data + n);
139 return m_data + m_number_of_elements;
144 return m_data + m_number_of_elements;
159 static constexpr bool VALUE =
false;
164 static constexpr bool VALUE =
true;
#define IOX2_ASSERT(condition, message)
only for debug builds: report fatal assert violation if expression evaluates to false
A class representing a slice of contiguous elements of type T.
auto number_of_bytes() const -> uint64_t
Returns the total number of bytes occupied by the slice.
auto operator[](uint64_t n) const -> const ValueType &
Accesses the element at the specified index (const version).
std::remove_const_t< T > ValueType
auto number_of_elements() const -> uint64_t
Returns the number of elements in the slice.
auto end() const -> ConstIterator
Returns an iterator to the end of the slice (const version).
auto begin() const -> ConstIterator
Returns an iterator to the beginning of the slice (const version).
auto data() const -> ConstIterator
Returns a pointer to the underlying data of the slice (const version).