Mbed OS Reference
Loading...
Searching...
No Matches
Span class

Data Structures

struct  Span< ElementType, Extent >
 Nonowning view to a sequence of contiguous elements. More...
 
struct  Span< ElementType, SPAN_DYNAMIC_EXTENT >
 Span specialization that handle dynamic size. More...
 

Functions

template<typename T , ptrdiff_t LhsExtent, ptrdiff_t RhsExtent>
bool operator== (const Span< T, LhsExtent > &lhs, T(&rhs)[RhsExtent])
 Equality operation between a Span and a reference to a C++ array. More...
 
template<typename T , ptrdiff_t LhsExtent, ptrdiff_t RhsExtent>
bool operator== (T(&lhs)[LhsExtent], const Span< T, RhsExtent > &rhs)
 Equality operation between a Span and a reference to a C++ array. More...
 
template<typename T , ptrdiff_t LhsExtent, ptrdiff_t RhsExtent>
bool operator!= (const Span< T, LhsExtent > &lhs, T(&rhs)[RhsExtent])
 Not Equal operation between a Span and a reference to a C++ array. More...
 
template<typename T , ptrdiff_t LhsExtent, ptrdiff_t RhsExtent>
bool operator!= (T(&lhs)[LhsExtent], const Span< T, RhsExtent > &rhs)
 Not Equal operation between a Span and a reference to a C++ array. More...
 
template<ptrdiff_t Extent, typename T >
Span< T, Extent > make_Span (T *elements)
 Generate a Span from a pointer to a C/C++ array. More...
 
template<typename T , size_t Extent>
Span< const T, Extent > make_const_Span (const T(&elements)[Extent])
 Generate a Span to a const content from a reference to a C/C++ array. More...
 
template<typename T , typename U , ptrdiff_t LhsExtent, ptrdiff_t RhsExtent>
bool operator== (const Span< T, LhsExtent > &lhs, const Span< U, RhsExtent > &rhs)
 Equality operator between two Span objects. More...
 
template<typename T , typename U , ptrdiff_t LhsExtent, ptrdiff_t RhsExtent>
bool operator!= (const Span< T, LhsExtent > &lhs, const Span< U, RhsExtent > &rhs)
 Not equal operator. More...
 
template<typename T , size_t Size>
Span< T, Size > make_Span (T(&elements)[Size])
 Generate a Span from a reference to a C/C++ array. More...
 
template<typename T >
Span< T > make_Span (T *array_ptr, ptrdiff_t array_size)
 Generate a Span from a C/C++ pointer and the size of the array. More...
 
template<size_t Extent, typename T >
Span< const T, Extent > make_const_Span (const T *elements)
 Generate a Span to a const content from a pointer to a C/C++ array. More...
 
template<typename T >
Span< const T > make_const_Span (T *array_ptr, size_t array_size)
 Generate a Span to a const content from a C/C++ pointer and the size of the array. More...
 

Variables

const ptrdiff_t SPAN_DYNAMIC_EXTENT = -1
 Special value for the Extent parameter of Span. More...
 

Detailed Description

Function Documentation

◆ operator==() [1/3]

bool operator== ( const Span< T, LhsExtent > &  lhs,
T(&)  rhs[RhsExtent] 
)

Equality operation between a Span and a reference to a C++ array.

Parameters
lhsLeft side of the binary operation.
rhsRight side of the binary operation.
Returns
True if elements in input have the same size and the same content and false otherwise.

Definition at line 932 of file Span.h.

◆ operator==() [2/3]

bool operator== ( T(&)  lhs[LhsExtent],
const Span< T, RhsExtent > &  rhs 
)

Equality operation between a Span and a reference to a C++ array.

Parameters
lhsLeft side of the binary operation.
rhsRight side of the binary operation.
Returns
True if elements in input have the same size and the same content and false otherwise.

Definition at line 947 of file Span.h.

◆ operator!=() [1/3]

bool operator!= ( const Span< T, LhsExtent > &  lhs,
T(&)  rhs[RhsExtent] 
)

Not Equal operation between a Span and a reference to a C++ array.

Parameters
lhsLeft side of the binary operation.
rhsRight side of the binary operation.
Returns
True if elements in input have the same size and the same content and false otherwise.

Definition at line 979 of file Span.h.

◆ operator!=() [2/3]

bool operator!= ( T(&)  lhs[LhsExtent],
const Span< T, RhsExtent > &  rhs 
)

Not Equal operation between a Span and a reference to a C++ array.

Parameters
lhsLeft side of the binary operation.
rhsRight side of the binary operation.
Returns
True if elements in input have the same size and the same content and false otherwise.

Definition at line 994 of file Span.h.

◆ make_Span() [1/3]

Span< T, Extent > make_Span ( T *  elements)

Generate a Span from a pointer to a C/C++ array.

Template Parameters
ExtentNumber of items held in elements.
TType of elements held in elements.
Parameters
elementsThe reference to the array viewed.
Returns
The Span to elements.
Note
This helper avoids the typing of template parameter when Span is created 'inline'.

Definition at line 1034 of file Span.h.

◆ make_const_Span() [1/3]

Span< const T, Extent > make_const_Span ( const T(&)  elements[Extent])

Generate a Span to a const content from a reference to a C/C++ array.

Template Parameters
TType of elements held in elements.
ExtentNumber of items held in elements.
Parameters
elementsThe array viewed.
Returns
The Span to elements.
Note
This helper avoids the typing of template parameter when Span is created 'inline'.

Definition at line 1073 of file Span.h.

◆ operator==() [3/3]

bool operator== ( const Span< T, LhsExtent > &  lhs,
const Span< U, RhsExtent > &  rhs 
)
related

Equality operator between two Span objects.

Parameters
lhsLeft side of the binary operation.
rhsRight side of the binary operation.
Returns
True if Spans in input have the same size and the same content and false otherwise.

Definition at line 907 of file Span.h.

◆ operator!=() [3/3]

bool operator!= ( const Span< T, LhsExtent > &  lhs,
const Span< U, RhsExtent > &  rhs 
)
related

Not equal operator.

Parameters
lhsLeft side of the binary operation.
rhsRight side of the binary operation.
Returns
True if arrays in input do not have the same size or the same content and false otherwise.

Definition at line 964 of file Span.h.

◆ make_Span() [2/3]

Span< T, Size > make_Span ( T(&)  elements[Size])
related

Generate a Span from a reference to a C/C++ array.

Template Parameters
TType of elements held in elements.
ExtentNumber of items held in elements.
Parameters
elementsThe reference to the array viewed.
Returns
The Span to elements.
Note
This helper avoids the typing of template parameter when Span is created 'inline'.

Definition at line 1015 of file Span.h.

◆ make_Span() [3/3]

Span< T > make_Span ( T *  array_ptr,
ptrdiff_t  array_size 
)
related

Generate a Span from a C/C++ pointer and the size of the array.

Template Parameters
TType of elements held in array_ptr.
Parameters
array_ptrThe pointer to the array viewed.
array_sizeThe number of T elements in the array.
Returns
The Span to array_ptr with a size of array_size.
Note
This helper avoids the typing of template parameter when Span is created 'inline'.

Definition at line 1055 of file Span.h.

◆ make_const_Span() [2/3]

Span< const T, Extent > make_const_Span ( const T *  elements)
related

Generate a Span to a const content from a pointer to a C/C++ array.

Template Parameters
ExtentNumber of items held in elements.
TType of elements held in elements.
Parameters
elementsThe reference to the array viewed.
Returns
The Span to elements.
Note
This helper avoids the typing of template parameter when Span is created 'inline'.

Definition at line 1094 of file Span.h.

◆ make_const_Span() [3/3]

Span< const T > make_const_Span ( T *  array_ptr,
size_t  array_size 
)
related

Generate a Span to a const content from a C/C++ pointer and the size of the array.

Template Parameters
TType of elements held in array_ptr.
Parameters
array_ptrThe pointer to the array to viewed.
array_sizeThe number of T elements in the array.
Returns
The Span to array_ptr with a size of array_size.
Note
This helper avoids the typing of template parameter when Span is created 'inline'.

Definition at line 1116 of file Span.h.

Variable Documentation

◆ SPAN_DYNAMIC_EXTENT

const ptrdiff_t SPAN_DYNAMIC_EXTENT = -1
related

Special value for the Extent parameter of Span.

If the type uses this value, then the size of the array is stored in the object at runtime.

Definition at line 69 of file Span.h.