Template Class span_crtp

Class Documentation

template<class T, class I, class SpanImpl>
class span_crtp

a crtp base for implementing span classes

A span is a non-owning range of elements contiguously stored in memory. Unlike STL’s array_view, the span allows write-access to its members.

To obtain subspans from a span, the following const member functions are available:

  • subspan(first, num)

  • range(first, last)

  • first(num)

  • last(num)

A span can also be resized via the following non-const member functions:

  • resize(sz)

  • ltrim(num)

  • rtrim(num)

See also

span

See also

cspan

See also

spanrs

See also

cspanrs

See also

spanrsl

See also

cspanrsl

Public Functions

_c4_DEFINE_ARRAY_TYPES(T, I)
inline constexpr C4_ALWAYS_INLINE I value_size () const noexcept
inline constexpr C4_ALWAYS_INLINE I elm_size () const noexcept
inline constexpr C4_ALWAYS_INLINE I type_size () const noexcept
inline C4_ALWAYS_INLINE I byte_size () const noexcept
inline C4_ALWAYS_INLINE bool empty () const noexcept
inline C4_ALWAYS_INLINE I size () const noexcept
inline C4_ALWAYS_INLINE void clear () noexcept
inline C4_ALWAYS_INLINE T * data () noexcept
inline C4_ALWAYS_INLINE T const  * data () const noexcept
inline C4_ALWAYS_INLINE iterator begin () noexcept
inline C4_ALWAYS_INLINE const_iterator begin () const noexcept
inline C4_ALWAYS_INLINE const_iterator cbegin () const noexcept
inline C4_ALWAYS_INLINE iterator end () noexcept
inline C4_ALWAYS_INLINE const_iterator end () const noexcept
inline C4_ALWAYS_INLINE const_iterator cend () const noexcept
inline C4_ALWAYS_INLINE reverse_iterator rbegin () noexcept
inline C4_ALWAYS_INLINE const_reverse_iterator rbegin () const noexcept
inline C4_ALWAYS_INLINE const_reverse_iterator crbegin () const noexcept
inline C4_ALWAYS_INLINE reverse_iterator rend () noexcept
inline C4_ALWAYS_INLINE const_reverse_iterator rend () const noexcept
inline C4_ALWAYS_INLINE const_reverse_iterator crend () const noexcept
inline C4_ALWAYS_INLINE T & front () C4_NOEXCEPT_X
inline C4_ALWAYS_INLINE T const  & front () const C4_NOEXCEPT_X
inline C4_ALWAYS_INLINE T & back () C4_NOEXCEPT_X
inline C4_ALWAYS_INLINE T const  & back () const C4_NOEXCEPT_X
inline C4_ALWAYS_INLINE T & operator[] (I i) C4_NOEXCEPT_X
inline C4_ALWAYS_INLINE T const  & operator[] (I i) const C4_NOEXCEPT_X
inline C4_ALWAYS_INLINE SpanImpl subspan (I first, I num) const C4_NOEXCEPT_X
inline C4_ALWAYS_INLINE SpanImpl subspan (I first) const C4_NOEXCEPT_X

< goes up until the end of the span

inline C4_ALWAYS_INLINE SpanImpl range (I first, I last) const C4_NOEXCEPT_X

< last element is NOT included

inline C4_ALWAYS_INLINE SpanImpl range (I first) const C4_NOEXCEPT_X

< goes up until the end of the span

inline C4_ALWAYS_INLINE SpanImpl first (I num) const C4_NOEXCEPT_X

< get the first num elements, starting at 0

inline C4_ALWAYS_INLINE SpanImpl last (I num) const C4_NOEXCEPT_X

< get the last num elements, starting at size()-num

inline bool is_subspan(span_crtp const &ss) const noexcept
inline SpanImpl compll (span_crtp const &ss) const C4_NOEXCEPT_X

COMPLement Left: return the complement to the left of the beginning of the given subspan. If ss does not begin inside this, returns an empty substring.

inline SpanImpl complr (span_crtp const &ss) const C4_NOEXCEPT_X

COMPLement Right: return the complement to the right of the end of the given subspan. If ss does not end inside this, returns an empty substring.

inline C4_ALWAYS_INLINE bool same_span (span_crtp const &that) const noexcept
template<class I2, class Impl2> inline C4_ALWAYS_INLINE bool same_span (span_crtp< T, I2, Impl2 > const &that) const C4_NOEXCEPT_X