span< Type > Class Template Reference

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

Public Types

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

Public Member Functions

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

Detailed Description

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

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

Definition at line 500 of file stdFoam.H.

Member Typedef Documentation

◆ element_type

using element_type = Type

Definition at line 519 of file stdFoam.H.

◆ value_type

using value_type = std::remove_cv<Type>

Definition at line 520 of file stdFoam.H.

◆ size_type

using size_type = std::size_t

Definition at line 521 of file stdFoam.H.

◆ pointer

using pointer = Type*

Definition at line 522 of file stdFoam.H.

◆ const_pointer

using const_pointer = const Type*

Definition at line 523 of file stdFoam.H.

◆ reference

using reference = Type&

Definition at line 524 of file stdFoam.H.

◆ const_reference

using const_reference = const Type&

Definition at line 525 of file stdFoam.H.

◆ difference_type

using difference_type = std::ptrdiff_t

Definition at line 526 of file stdFoam.H.

◆ iterator

using iterator = Type*

Definition at line 527 of file stdFoam.H.

Constructor & Destructor Documentation

◆ span() [1/4]

span ( const span< Type > &  other)
defaultnoexcept

Copy construct.

◆ span() [2/4]

constexpr span ( )
inlinenoexcept

Default construct.

Definition at line 548 of file stdFoam.H.

◆ span() [3/4]

constexpr span ( pointer  ptr,
size_type  count 
)
inlinenoexcept

Construct from pointer and size.

Definition at line 557 of file stdFoam.H.

◆ span() [4/4]

constexpr span ( pointer  first,
pointer  last 
)
inlinenoexcept

Construct from begin/end pointers.

Definition at line 566 of file stdFoam.H.

◆ ~span()

~span ( )
defaultnoexcept

Destructor.

Member Function Documentation

◆ operator=()

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

Copy assignment.

◆ begin()

constexpr iterator begin ( ) const
inlinenoexcept

Iterator to begin of span.

Definition at line 586 of file stdFoam.H.

◆ end()

constexpr iterator end ( ) const
inlinenoexcept

Iterator to one-past end of span.

Definition at line 591 of file stdFoam.H.

◆ front()

constexpr reference front ( ) const
inline

Access the first element. Undefined if span is empty.

Definition at line 599 of file stdFoam.H.

◆ back()

constexpr reference back ( ) const
inline

Access the last element. Undefined if span is empty.

Definition at line 604 of file stdFoam.H.

◆ operator[]()

constexpr reference operator[] ( size_type  idx) const
inline

Access an element of the sequence.

Definition at line 609 of file stdFoam.H.

◆ data()

constexpr pointer data ( ) const
inlinenoexcept

Return a pointer to the beginning of the sequence.

Definition at line 617 of file stdFoam.H.

◆ size()

constexpr size_type size ( ) const
inlinenoexcept

Number of elements in the sequence.

Definition at line 625 of file stdFoam.H.

◆ size_bytes()

constexpr size_type size_bytes ( ) const
inlinenoexcept

The size of the sequence in bytes.

Definition at line 630 of file stdFoam.H.

◆ empty()

constexpr bool empty ( ) const
inlinenoexcept

True if the sequence is empty.

Definition at line 638 of file stdFoam.H.

◆ first()

span<Type> first ( size_type  count) const
inlinenoexcept

Obtains a span of the first count elements.

Definition at line 646 of file stdFoam.H.

References Foam::BitOps::count().

Here is the call graph for this function:

◆ last()

span<Type> last ( size_type  count) const
inlinenoexcept

Obtains a span of the last count elements.

Definition at line 654 of file stdFoam.H.

References Foam::BitOps::count().

Here is the call graph for this function:

◆ subspan() [1/2]

span<Type> subspan ( size_type  pos) const
inlinenoexcept

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

Definition at line 662 of file stdFoam.H.

References Foam::pos().

Here is the call graph for this function:

◆ subspan() [2/2]

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 672 of file stdFoam.H.

References stdFoam::min(), and Foam::pos().

Here is the call graph for this function:

◆ cdata_bytes()

constexpr const char* cdata_bytes ( ) const
inlinenoexcept

A readonly view as byte content.

Definition at line 684 of file stdFoam.H.

◆ data_bytes()

std::enable_if<!std::is_const<TypeT>::value, char*>::type data_bytes ( ) const
inlinenoexcept

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

Definition at line 695 of file stdFoam.H.


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