Span< T > Class Template Reference

CPP API: mio::Span< T > Class Template Reference
mio::Span< T > Class Template Reference

a reference to any contigiuous array of objects. More...

#include <span.h>

Public Member Functions

const T * begin () const
 get an iterator to the first element. More...
 
const T * end () const
 get an iterator to one past the last element. More...
 
const T * get_ptr () const
 get the adress of the beginning of array. More...
 
size_t size () const
 get the number of elements in the array More...
 
 Span ()=default
 empty span. More...
 
template<class Cont >
 Span (const Cont &c)
 construct from a container. More...
 
 Span (const T *ptr, size_t size)
 construct from ptr and size. More...
 
template<size_t N>
 Span (T(&p)[N])
 construct from a c array. More...
 

Private Attributes

const T * m_ptr = nullptr
 
size_t m_size = 0
 

Detailed Description

template<class T>
class mio::Span< T >

a reference to any contigiuous array of objects.

Constructor & Destructor Documentation

◆ Span() [1/4]

template<class T >
mio::Span< T >::Span ( )
default

empty span.

◆ Span() [2/4]

template<class T >
template<class Cont >
mio::Span< T >::Span ( const Cont &  c)
inline

construct from a container.

e.g. std::vector or std::array

◆ Span() [3/4]

template<class T >
template<size_t N>
mio::Span< T >::Span ( T(&)  p[N])
inline

construct from a c array.

◆ Span() [4/4]

template<class T >
mio::Span< T >::Span ( const T *  ptr,
size_t  size 
)
inline

construct from ptr and size.

Member Function Documentation

◆ begin()

template<class T >
const T* mio::Span< T >::begin ( ) const
inline

get an iterator to the first element.

◆ end()

template<class T >
const T* mio::Span< T >::end ( ) const
inline

get an iterator to one past the last element.

◆ get_ptr()

template<class T >
const T* mio::Span< T >::get_ptr ( ) const
inline

get the adress of the beginning of array.

◆ size()

template<class T >
size_t mio::Span< T >::size ( ) const
inline

get the number of elements in the array

Member Data Documentation

◆ m_ptr

template<class T >
const T* mio::Span< T >::m_ptr = nullptr
private

◆ m_size

template<class T >
size_t mio::Span< T >::m_size = 0
private