upkie 9.0.1
Open-source wheeled biped robots
|
Fixed-size array with runtime size information. More...
#include <Span.h>
Public Member Functions | |
Span (T *ptr, size_t size) | |
Store info to an allocated array. | |
Span () | |
Empty array. | |
T * | data () |
Get pointer to first element. | |
T * | data () const |
Const-variant of data() | |
size_t | size () const |
Get size of allocated area. | |
bool | empty () const |
Check if area is empty. | |
T & | operator[] (size_t i) |
Get i-th array element. | |
T & | operator[] (size_t i) const |
Get i-th array element. | |
T * | begin () |
Get pointer to the first element of the array. | |
T * | end () |
Get pointer to the last element of the array. | |
const T * | begin () const |
Get const pointer to the first element of the array. | |
const T * | end () const |
Get const pointer to the last element of the array. | |
Fixed-size array with runtime size information.
This class assumes the array is allocated and deallocated externally. It stores a pointer to and the size of the allocated memory area.