nros C++ API
Lightweight ROS 2 client for embedded real-time systems (C++ headers)
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
nros::Span< T > Struct Template Reference

#include <span.hpp>

Public Member Functions

constexpr const Tbegin () const
 Iterator to the first element.
 
constexpr const Tdata () const
 Pointer to the underlying storage.
 
constexpr bool empty () const
 True if the view contains zero elements.
 
constexpr const Tend () const
 Iterator past the last element.
 
constexpr const Toperator[] (size_t i) const
 Element access; no bounds check.
 
constexpr size_t size () const
 Number of elements (alias for len).
 

Public Attributes

size_t len
 Number of elements in the view.
 
const Tptr
 Pointer to the first element. Borrowed — caller-owned storage.
 

Detailed Description

template<typename T>
struct nros::Span< T >

Non-owning view over a contiguous sequence of T values.

Same semantics as std::span<const T> but requires only C++14. The data pointer is valid only for the lifetime of the source buffer (typically the subscription callback scope).

Member Function Documentation

◆ begin()

template<typename T >
constexpr const T * nros::Span< T >::begin ( ) const
inlineconstexpr

Iterator to the first element.

◆ data()

template<typename T >
constexpr const T * nros::Span< T >::data ( ) const
inlineconstexpr

Pointer to the underlying storage.

◆ empty()

template<typename T >
constexpr bool nros::Span< T >::empty ( ) const
inlineconstexpr

True if the view contains zero elements.

◆ end()

template<typename T >
constexpr const T * nros::Span< T >::end ( ) const
inlineconstexpr

Iterator past the last element.

◆ operator[]()

template<typename T >
constexpr const T & nros::Span< T >::operator[] ( size_t  i) const
inlineconstexpr

Element access; no bounds check.

◆ size()

template<typename T >
constexpr size_t nros::Span< T >::size ( ) const
inlineconstexpr

Number of elements (alias for len).

Member Data Documentation

◆ len

template<typename T >
size_t nros::Span< T >::len

Number of elements in the view.

◆ ptr

template<typename T >
const T* nros::Span< T >::ptr

Pointer to the first element. Borrowed — caller-owned storage.


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