ONE - On-device Neural Engine
Loading...
Searching...
No Matches
coco::Span< T > Class Template Reference

A Span is a non-owing reference to a memory chunk. More...

#include <Span.h>

Public Member Functions

 Span (T *data, uint32_t size)
 
T * data (void)
 
const T * data (void) const
 
uint32_t size (void) const
 
T & operator[] (uint32_t n)
 
const T & operator[] (uint32_t n) const
 

Detailed Description

template<typename T>
class coco::Span< T >

A Span is a non-owing reference to a memory chunk.

Note
A Span DOES NOT OWN a memory chunk.

Definition at line 31 of file Span.h.

Constructor & Destructor Documentation

◆ Span()

template<typename T >
coco::Span< T >::Span ( T *  data,
uint32_t  size 
)
inline

Definition at line 34 of file Span.h.

34 : _data{data}, _size{size}
35 {
36 // DO NOTHING
37 }
T * data(void)
Definition Span.h:40
uint32_t size(void) const
Definition Span.h:44

Member Function Documentation

◆ data() [1/2]

template<typename T >
T * coco::Span< T >::data ( void  )
inline

Definition at line 40 of file Span.h.

40{ return _data; }

◆ data() [2/2]

template<typename T >
const T * coco::Span< T >::data ( void  ) const
inline

Definition at line 41 of file Span.h.

41{ return _data; }

◆ operator[]() [1/2]

template<typename T >
T & coco::Span< T >::operator[] ( uint32_t  n)
inline

Definition at line 47 of file Span.h.

48 {
49 assert(n < _size);
50 return *(_data + n);
51 }

◆ operator[]() [2/2]

template<typename T >
const T & coco::Span< T >::operator[] ( uint32_t  n) const
inline

Definition at line 54 of file Span.h.

55 {
56 assert(n < _size);
57 return *(_data + n);
58 }

◆ size()

template<typename T >
uint32_t coco::Span< T >::size ( void  ) const
inline

Definition at line 44 of file Span.h.

44{ return _size; }

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