Loading...
Searching...
No Matches
span< Type > Class Template Reference

Rudimentary functionality similar to std::span for holding memory view. More...

#include <stdFoam.H>

Public Types

using element_type = Type
using value_type = std::remove_cv_t<Type>
using size_type = std::size_t
using difference_type = std::ptrdiff_t
using pointer = Type*
using const_pointer = const Type*
using reference = element_type&
using const_reference = const element_type&
using iterator = Type*

Public Member Functions

 span (const span &other) noexcept=default
 Copy construct.
spanoperator= (const span &other) noexcept=default
 Copy assignment.
constexpr span () noexcept
 Default construct.
constexpr span (pointer ptr, size_type count) noexcept
 Construct from pointer and size.
constexpr span (pointer first, pointer last) noexcept
 Construct from begin/end pointers.
 ~span () noexcept=default
 Destructor.
constexpr iterator begin () const noexcept
 Iterator to begin of span.
constexpr iterator end () const noexcept
 Iterator to one-past end of span.
constexpr reference front () const
 Access the first element. Undefined if span is empty.
constexpr reference back () const
 Access the last element. Undefined if span is empty.
constexpr reference operator[] (size_type idx) const
 Access an element of the sequence.
constexpr pointer data () const noexcept
 Return a pointer to the beginning of the sequence.
constexpr size_type size () const noexcept
 Number of elements in the sequence.
constexpr size_type size_bytes () const noexcept
 The size of the sequence in bytes.
constexpr bool empty () const noexcept
 True if the sequence is empty.
span< Type > first (size_type count) const noexcept
 Obtains a span of the first count elements.
span< Type > last (size_type count) const noexcept
 Obtains a span of the last count elements.
span< Type > subspan (size_type pos) const noexcept
 Obtains a sub-span starting at pos until end of the sequence.
span< Type > subspan (size_type pos, size_type len) const noexcept
 Obtains a sub-span of length len starting at pos.
constexpr const char * cdata_bytes () const noexcept
 A readonly view as byte content.
template<class TypeT = Type, class = std::enable_if_t<!std::is_const_v<TypeT>>>
char * data_bytes () const noexcept
 A writable view as byte content (if the pointer type is non-const). Like data(), the access itself is const.

Detailed Description

template<class Type>
class stdFoam::span< Type >

Rudimentary functionality similar to std::span for holding memory view.

Definition at line 378 of file stdFoam.H.

Member Typedef Documentation

◆ element_type

template<class Type>
using element_type = Type

Definition at line 397 of file stdFoam.H.

◆ value_type

template<class Type>
using value_type = std::remove_cv_t<Type>

Definition at line 398 of file stdFoam.H.

◆ size_type

template<class Type>
using size_type = std::size_t

Definition at line 399 of file stdFoam.H.

◆ difference_type

template<class Type>
using difference_type = std::ptrdiff_t

Definition at line 400 of file stdFoam.H.

◆ pointer

template<class Type>
using pointer = Type*

Definition at line 401 of file stdFoam.H.

◆ const_pointer

template<class Type>
using const_pointer = const Type*

Definition at line 402 of file stdFoam.H.

◆ reference

template<class Type>
using reference = element_type&

Definition at line 403 of file stdFoam.H.

◆ const_reference

template<class Type>
using const_reference = const element_type&

Definition at line 404 of file stdFoam.H.

◆ iterator

template<class Type>
using iterator = Type*

Definition at line 405 of file stdFoam.H.

Constructor & Destructor Documentation

◆ span() [1/4]

template<class Type>
span ( const span< Type > & other)
defaultnoexcept

Copy construct.

References span().

Referenced by first(), last(), operator=(), span(), subspan(), and subspan().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ span() [2/4]

template<class Type>
span ( )
inlineconstexprnoexcept

Default construct.

Definition at line 426 of file stdFoam.H.

Referenced by first(), last(), subspan(), and subspan().

Here is the caller graph for this function:

◆ span() [3/4]

template<class Type>
span ( pointer ptr,
size_type count )
inlineconstexprnoexcept

Construct from pointer and size.

Definition at line 435 of file stdFoam.H.

◆ span() [4/4]

template<class Type>
span ( pointer first,
pointer last )
inlineconstexprnoexcept

Construct from begin/end pointers.

Definition at line 444 of file stdFoam.H.

References first(), and last().

Here is the call graph for this function:

◆ ~span()

template<class Type>
~span ( )
defaultnoexcept

Destructor.

Member Function Documentation

◆ operator=()

template<class Type>
span & operator= ( const span< Type > & other)
defaultnoexcept

Copy assignment.

References span().

Here is the call graph for this function:

◆ begin()

template<class Type>
iterator begin ( ) const
inlineconstexprnoexcept

Iterator to begin of span.

Definition at line 464 of file stdFoam.H.

References begin().

Referenced by begin().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ end()

template<class Type>
iterator end ( ) const
inlineconstexprnoexcept

Iterator to one-past end of span.

Definition at line 469 of file stdFoam.H.

◆ front()

template<class Type>
reference front ( ) const
inlineconstexpr

Access the first element. Undefined if span is empty.

Definition at line 477 of file stdFoam.H.

◆ back()

template<class Type>
reference back ( ) const
inlineconstexpr

Access the last element. Undefined if span is empty.

Definition at line 482 of file stdFoam.H.

◆ operator[]()

template<class Type>
reference operator[] ( size_type idx) const
inlineconstexpr

Access an element of the sequence.

Definition at line 487 of file stdFoam.H.

◆ data()

template<class Type>
pointer data ( ) const
inlineconstexprnoexcept

Return a pointer to the beginning of the sequence.

Definition at line 495 of file stdFoam.H.

◆ size()

template<class Type>
size_type size ( ) const
inlineconstexprnoexcept

Number of elements in the sequence.

Definition at line 503 of file stdFoam.H.

◆ size_bytes()

template<class Type>
size_type size_bytes ( ) const
inlineconstexprnoexcept

The size of the sequence in bytes.

Definition at line 508 of file stdFoam.H.

◆ empty()

template<class Type>
bool empty ( ) const
inlineconstexprnoexcept

True if the sequence is empty.

Definition at line 516 of file stdFoam.H.

◆ first()

template<class Type>
span< Type > first ( size_type count) const
inlinenoexcept

Obtains a span of the first count elements.

Definition at line 524 of file stdFoam.H.

References span(), and span().

Referenced by span().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ last()

template<class Type>
span< Type > last ( size_type count) const
inlinenoexcept

Obtains a span of the last count elements.

Definition at line 532 of file stdFoam.H.

References span(), and span().

Referenced by span().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ subspan() [1/2]

template<class Type>
span< Type > subspan ( size_type pos) const
inlinenoexcept

Obtains a sub-span starting at pos until end of the sequence.

Definition at line 540 of file stdFoam.H.

References span(), and span().

Here is the call graph for this function:

◆ subspan() [2/2]

template<class Type>
span< Type > subspan ( size_type pos,
size_type len ) const
inlinenoexcept

Obtains a sub-span of length len starting at pos.

Graciously handles excess lengths.

Definition at line 550 of file stdFoam.H.

References span(), and span().

Here is the call graph for this function:

◆ cdata_bytes()

template<class Type>
const char * cdata_bytes ( ) const
inlineconstexprnoexcept

A readonly view as byte content.

Definition at line 562 of file stdFoam.H.

◆ data_bytes()

template<class Type>
template<class TypeT = Type, class = std::enable_if_t<!std::is_const_v<TypeT>>>
char * data_bytes ( ) const
inlinenoexcept

A writable view as byte content (if the pointer type is non-const). Like data(), the access itself is const.

Definition at line 576 of file stdFoam.H.


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