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_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. 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, 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. More...
 

Detailed Description

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

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

Definition at line 479 of file stdFoam.H.

Member Typedef Documentation

◆ element_type

using element_type = Type

Definition at line 498 of file stdFoam.H.

◆ value_type

using value_type = std::remove_cv_t<Type>

Definition at line 499 of file stdFoam.H.

◆ size_type

using size_type = std::size_t

Definition at line 500 of file stdFoam.H.

◆ difference_type

using difference_type = std::ptrdiff_t

Definition at line 501 of file stdFoam.H.

◆ pointer

using pointer = Type*

Definition at line 502 of file stdFoam.H.

◆ const_pointer

using const_pointer = const Type*

Definition at line 503 of file stdFoam.H.

◆ reference

Definition at line 504 of file stdFoam.H.

◆ const_reference

using const_reference = const element_type&

Definition at line 505 of file stdFoam.H.

◆ iterator

using iterator = Type*

Definition at line 506 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 527 of file stdFoam.H.

◆ span() [3/4]

constexpr span ( pointer  ptr,
size_type  count 
)
inlinenoexcept

Construct from pointer and size.

Definition at line 536 of file stdFoam.H.

◆ span() [4/4]

constexpr span ( pointer  first,
pointer  last 
)
inlinenoexcept

Construct from begin/end pointers.

Definition at line 545 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 565 of file stdFoam.H.

◆ end()

constexpr iterator end ( ) const
inlinenoexcept

Iterator to one-past end of span.

Definition at line 570 of file stdFoam.H.

◆ front()

constexpr reference front ( ) const
inline

Access the first element. Undefined if span is empty.

Definition at line 578 of file stdFoam.H.

◆ back()

constexpr reference back ( ) const
inline

Access the last element. Undefined if span is empty.

Definition at line 583 of file stdFoam.H.

◆ operator[]()

constexpr reference operator[] ( size_type  idx) const
inline

Access an element of the sequence.

Definition at line 588 of file stdFoam.H.

◆ data()

constexpr pointer data ( ) const
inlinenoexcept

Return a pointer to the beginning of the sequence.

Definition at line 596 of file stdFoam.H.

◆ size()

constexpr size_type size ( ) const
inlinenoexcept

Number of elements in the sequence.

Definition at line 604 of file stdFoam.H.

◆ size_bytes()

constexpr size_type size_bytes ( ) const
inlinenoexcept

The size of the sequence in bytes.

Definition at line 609 of file stdFoam.H.

◆ empty()

constexpr bool empty ( ) const
inlinenoexcept

True if the sequence is empty.

Definition at line 617 of file stdFoam.H.

◆ first()

span<Type> first ( size_type  count) const
inlinenoexcept

Obtains a span of the first count elements.

Definition at line 625 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 633 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 641 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 651 of file stdFoam.H.

References Foam::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 663 of file stdFoam.H.

◆ data_bytes()

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


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