Quick Links: |
Provide a (mostly) standard-compliant span
class template.
More...
Classes | |
struct | bsl::Span_Utility |
struct | bsl::Span_Utility::SubspanReturnType< TYPE, EXTENT, COUNT, OFFSET > |
struct | bsl::Span_Utility::TypeIdentity< TYPE > |
struct | bsl::Span_Utility::IsSpanImpl< TP > |
struct | bsl::Span_Utility::IsSpanImpl< span< TP, SZ > > |
struct | bsl::Span_Utility::IsSpan< TP > |
struct | bsl::Span_Utility::IsBSLArrayImpl< TP > |
struct | bsl::Span_Utility::IsBSLArrayImpl< bsl::array< TP, SZ > > |
struct | bsl::Span_Utility::IsBSLArray< TP > |
struct | bsl::Span_Utility::IsSTDArrayImpl< TP > |
struct | bsl::Span_Utility::IsSTDArrayImpl< std::array< TP, SZ > > |
struct | bsl::Span_Utility::IsSTDArray< TP > |
struct | bsl::Span_Utility::IsSpanCompatibleContainer< TP, ELEMENT_TYPE, class > |
struct | bsl::Span_Utility::IsSpanCompatibleContainer< TP, ELEMENT_TYPE, bsl::void_t< typename bsl::enable_if<!IsSpan< TP >::value, bsl::nullptr_t >::type, typename bsl::enable_if< !IsBSLArray< TP >::value, bsl::nullptr_t >::type, typename bsl::enable_if< !IsSTDArray< TP >::value, bsl::nullptr_t >::type, typename bsl::enable_if< !bsl::is_array< TP >::value, bsl::nullptr_t >::type, decltype(data(std::declval< TP >())), decltype(size(std::declval< TP >())), typename bsl::enable_if< Span_Utility::IsArrayConvertible< typename bsl::remove_pointer< decltype(data(std::declval< TP & >()))>::type, ELEMENT_TYPE >::value, bsl::nullptr_t >::type > > |
class | bsl::span< TYPE, EXTENT > |
class | bsl::span< TYPE, dynamic_extent > |
Typedefs | |
typedef bsl::remove_cv< TYPE > ::type | bsl::span::value_type |
typedef size_t | bsl::span::size_type |
typedef ptrdiff_t | bsl::span::difference_type |
typedef TYPE * | bsl::span::pointer |
typedef const TYPE * | bsl::span::const_pointer |
typedef TYPE & | bsl::span::reference |
typedef const TYPE & | bsl::span::const_reference |
typedef pointer | bsl::span::iterator |
typedef bsl::reverse_iterator < iterator > | bsl::span::reverse_iterator |
typedef bsl::remove_cv< TYPE > ::type | bsl::span< TYPE, dynamic_extent >::value_type |
typedef size_t | bsl::span< TYPE, dynamic_extent >::size_type |
typedef ptrdiff_t | bsl::span< TYPE, dynamic_extent >::difference_type |
typedef TYPE * | bsl::span< TYPE, dynamic_extent >::pointer |
typedef const TYPE * | bsl::span< TYPE, dynamic_extent >::const_pointer |
typedef TYPE & | bsl::span< TYPE, dynamic_extent >::reference |
typedef const TYPE & | bsl::span< TYPE, dynamic_extent >::const_reference |
typedef pointer | bsl::span< TYPE, dynamic_extent >::iterator |
typedef bsl::reverse_iterator < iterator > | bsl::span< TYPE, dynamic_extent >::reverse_iterator |
Functions | |
BSLS_KEYWORD_CONSTEXPR_CPP14 | bsl::span::span () BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR_CPP14 | bsl::span::span (const span &original) BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR_CPP14 | bsl::span::span (pointer ptr, size_type count) |
BSLS_KEYWORD_CONSTEXPR_CPP14 | bsl::span::span (pointer first, pointer last) |
template<size_t SIZE> | |
BSLS_KEYWORD_CONSTEXPR_CPP14 | bsl::span::span (typename Span_Utility::TypeIdentity< element_type >::type(&arr)[SIZE]) BSLS_KEYWORD_NOEXCEPT |
template<class t_OTHER_TYPE > | |
BSLS_KEYWORD_CONSTEXPR_CPP14 | bsl::span::span (bsl::array< t_OTHER_TYPE, EXTENT > &arr, typename bsl::enable_if< Span_Utility::IsArrayConvertible< t_OTHER_TYPE, element_type >::value, void * >::type=NULL) BSLS_KEYWORD_NOEXCEPT |
template<class t_OTHER_TYPE > | |
BSLS_KEYWORD_CONSTEXPR_CPP14 | bsl::span::span (const bsl::array< t_OTHER_TYPE, EXTENT > &arr, typename bsl::enable_if< Span_Utility::IsArrayConvertible< const t_OTHER_TYPE, element_type >::value, void * >::type=NULL) BSLS_KEYWORD_NOEXCEPT |
template<class t_OTHER_TYPE > | |
BSLS_KEYWORD_CONSTEXPR_CPP14 | bsl::span::span (std::array< t_OTHER_TYPE, EXTENT > &arr, typename bsl::enable_if< Span_Utility::IsArrayConvertible< t_OTHER_TYPE, element_type >::value, void * >::type=NULL) BSLS_KEYWORD_NOEXCEPT |
template<class t_OTHER_TYPE > | |
BSLS_KEYWORD_CONSTEXPR_CPP14 | bsl::span::span (const std::array< t_OTHER_TYPE, EXTENT > &arr, typename bsl::enable_if< Span_Utility::IsArrayConvertible< const t_OTHER_TYPE, element_type >::value, void * >::type=NULL) BSLS_KEYWORD_NOEXCEPT |
template<class t_OTHER_TYPE > | |
BSLS_KEYWORD_CONSTEXPR_CPP14 | bsl::span::span (const span< t_OTHER_TYPE, EXTENT > &other, typename bsl::enable_if< Span_Utility::IsArrayConvertible< t_OTHER_TYPE, element_type >::value, void * >::type=NULL) BSLS_KEYWORD_NOEXCEPT |
template<class t_OTHER_TYPE > | |
BSLS_KEYWORD_CONSTEXPR_CPP14 | bsl::span::span (const span< t_OTHER_TYPE, dynamic_extent > &other, typename bsl::enable_if< Span_Utility::IsArrayConvertible< t_OTHER_TYPE, element_type >::value, void * >::type=NULL) BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR_CPP14 reference | bsl::span::back () const BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR pointer | bsl::span::data () const BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR bool | bsl::span::empty () const BSLS_KEYWORD_NOEXCEPT |
template<size_t COUNT> | |
BSLS_KEYWORD_CONSTEXPR_CPP14 span< element_type, COUNT > | bsl::span::first () const BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR_CPP14 span< element_type, dynamic_extent > | bsl::span::first (size_type count) const BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR_CPP14 reference | bsl::span::front () const BSLS_KEYWORD_NOEXCEPT |
template<size_t COUNT> | |
BSLS_KEYWORD_CONSTEXPR_CPP14 span< element_type, COUNT > | bsl::span::last () const BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR_CPP14 span< element_type, dynamic_extent > | bsl::span::last (size_type count) const BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR size_type | bsl::span::size () const BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR size_type | bsl::span::size_bytes () const BSLS_KEYWORD_NOEXCEPT |
template<size_t OFFSET, size_t COUNT> | |
BSLS_KEYWORD_CONSTEXPR_CPP14 Span_Utility::SubspanReturnType < TYPE, EXTENT, COUNT, OFFSET > ::type | bsl::span::subspan () const BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR_CPP14 span< element_type, dynamic_extent > | bsl::span::subspan (size_type offset, size_type count=dynamic_extent) const BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR_CPP14 reference | bsl::span::operator[] (size_type index) const BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR_CPP14 iterator | bsl::span::begin () const BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR_CPP14 iterator | bsl::span::end () const BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR_CPP14 reverse_iterator | bsl::span::rbegin () const BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR_CPP14 reverse_iterator | bsl::span::rend () const BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR_CPP14 span & | bsl::span::operator= (const span &) BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR_CPP14 void | bsl::span::swap (span &other) BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR_CPP14 | bsl::span< TYPE, dynamic_extent >::span () BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR_CPP14 | bsl::span< TYPE, dynamic_extent >::span (const span &original) BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR_CPP14 | bsl::span< TYPE, dynamic_extent >::span (pointer ptr, size_type count) |
BSLS_KEYWORD_CONSTEXPR_CPP14 | bsl::span< TYPE, dynamic_extent >::span (pointer first, pointer last) |
template<size_t SIZE> | |
BSLS_KEYWORD_CONSTEXPR_CPP14 | bsl::span< TYPE, dynamic_extent >::span (typename Span_Utility::TypeIdentity< element_type >::type(&arr)[SIZE]) BSLS_KEYWORD_NOEXCEPT |
template<class t_OTHER_TYPE , size_t SIZE> | |
BSLS_KEYWORD_CONSTEXPR_CPP14 | bsl::span< TYPE, dynamic_extent >::span (bsl::array< t_OTHER_TYPE, SIZE > &arr, typename bsl::enable_if< Span_Utility::IsArrayConvertible< t_OTHER_TYPE, element_type >::value, void * >::type=NULL) BSLS_KEYWORD_NOEXCEPT |
template<class t_OTHER_TYPE , size_t SIZE> | |
BSLS_KEYWORD_CONSTEXPR_CPP14 | bsl::span< TYPE, dynamic_extent >::span (const bsl::array< t_OTHER_TYPE, SIZE > &arr, typename bsl::enable_if< Span_Utility::IsArrayConvertible< const t_OTHER_TYPE, element_type >::value, void * >::type=NULL) BSLS_KEYWORD_NOEXCEPT |
template<class t_OTHER_TYPE , size_t SIZE> | |
BSLS_KEYWORD_CONSTEXPR_CPP14 | bsl::span< TYPE, dynamic_extent >::span (std::array< t_OTHER_TYPE, SIZE > &arr, typename bsl::enable_if< Span_Utility::IsArrayConvertible< t_OTHER_TYPE, element_type >::value, void * >::type=NULL) BSLS_KEYWORD_NOEXCEPT |
template<class t_OTHER_TYPE , size_t SIZE> | |
BSLS_KEYWORD_CONSTEXPR_CPP14 | bsl::span< TYPE, dynamic_extent >::span (const std::array< t_OTHER_TYPE, SIZE > &arr, typename bsl::enable_if< Span_Utility::IsArrayConvertible< const t_OTHER_TYPE, element_type >::value, void * >::type=NULL) BSLS_KEYWORD_NOEXCEPT |
template<class CONTAINER > | |
BSLS_KEYWORD_CONSTEXPR_CPP14 | bsl::span< TYPE, dynamic_extent >::span (CONTAINER &c, typename bsl::enable_if< Span_Utility::IsSpanCompatibleContainer< CONTAINER, TYPE >::value, void * >::type=NULL) |
template<class CONTAINER > | |
BSLS_KEYWORD_CONSTEXPR_CPP14 | bsl::span< TYPE, dynamic_extent >::span (const CONTAINER &c, typename bsl::enable_if< Span_Utility::IsSpanCompatibleContainer< const CONTAINER, TYPE >::value, void * >::type=NULL) |
template<class t_OTHER_TYPE , size_t OTHER_EXTENT> | |
BSLS_KEYWORD_CONSTEXPR_CPP14 | bsl::span< TYPE, dynamic_extent >::span (const span< t_OTHER_TYPE, OTHER_EXTENT > &other, typename bsl::enable_if< Span_Utility::IsArrayConvertible< t_OTHER_TYPE, element_type >::value, void * >::type=NULL) BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR_CPP14 reference | bsl::span< TYPE, dynamic_extent >::back () const BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR pointer | bsl::span< TYPE, dynamic_extent >::data () const BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR bool | bsl::span< TYPE, dynamic_extent >::empty () const BSLS_KEYWORD_NOEXCEPT |
template<size_t COUNT> | |
BSLS_KEYWORD_CONSTEXPR_CPP14 span< element_type, COUNT > | bsl::span< TYPE, dynamic_extent >::first () const BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR_CPP14 span< element_type, dynamic_extent > | bsl::span< TYPE, dynamic_extent >::first (size_type count) const BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR_CPP14 reference | bsl::span< TYPE, dynamic_extent >::front () const BSLS_KEYWORD_NOEXCEPT |
template<size_t COUNT> | |
BSLS_KEYWORD_CONSTEXPR_CPP14 span< element_type, COUNT > | bsl::span< TYPE, dynamic_extent >::last () const BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR_CPP14 span< element_type, dynamic_extent > | bsl::span< TYPE, dynamic_extent >::last (size_type count) const BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR size_type | bsl::span< TYPE, dynamic_extent >::size () const BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR size_type | bsl::span< TYPE, dynamic_extent >::size_bytes () const BSLS_KEYWORD_NOEXCEPT |
template<size_t OFFSET, size_t COUNT> | |
BSLS_KEYWORD_CONSTEXPR_CPP14 span< element_type, COUNT > | bsl::span< TYPE, dynamic_extent >::subspan () const BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR_CPP14 span< element_type, dynamic_extent > | bsl::span< TYPE, dynamic_extent >::subspan (size_type offset, size_type count=dynamic_extent) const BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR_CPP14 reference | bsl::span< TYPE, dynamic_extent >::operator[] (size_type index) const BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR_CPP14 iterator | bsl::span< TYPE, dynamic_extent >::begin () const BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR_CPP14 iterator | bsl::span< TYPE, dynamic_extent >::end () const BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR_CPP14 reverse_iterator | bsl::span< TYPE, dynamic_extent >::rbegin () const BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR_CPP14 reverse_iterator | bsl::span< TYPE, dynamic_extent >::rend () const BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR_CPP14 span & | bsl::span< TYPE, dynamic_extent >::operator= (const span &rhs) BSLS_KEYWORD_NOEXCEPT |
BSLS_KEYWORD_CONSTEXPR_CPP14 void | bsl::span< TYPE, dynamic_extent >::swap (span &other) BSLS_KEYWORD_NOEXCEPT |
template<class TYPE , size_t EXTENT> | |
BSLS_KEYWORD_CONSTEXPR_CPP14 span< const std::byte, EXTENT *sizeof(TYPE)> | bsl::as_bytes (span< TYPE, EXTENT > s) BSLS_KEYWORD_NOEXCEPT |
template<class TYPE > | |
BSLS_KEYWORD_CONSTEXPR_CPP14 span< const std::byte, dynamic_extent > | bsl::as_bytes (span< TYPE, dynamic_extent > s) BSLS_KEYWORD_NOEXCEPT |
template<class TYPE , size_t EXTENT> | |
BSLS_KEYWORD_CONSTEXPR_CPP14 span< std::byte, EXTENT *sizeof(TYPE)> | bsl::as_writable_bytes (span< TYPE, EXTENT > s) BSLS_KEYWORD_NOEXCEPT |
template<class TYPE > | |
BSLS_KEYWORD_CONSTEXPR_CPP14 span< std::byte, dynamic_extent > | bsl::as_writable_bytes (span< TYPE, dynamic_extent > s) BSLS_KEYWORD_NOEXCEPT |
template<class TYPE , size_t EXTENT> | |
BSLS_KEYWORD_CONSTEXPR_CPP14 void | bsl::swap (span< TYPE, EXTENT > &a, span< TYPE, EXTENT > &b) BSLS_KEYWORD_NOEXCEPT |
Variables | |
static BSLS_KEYWORD_CONSTEXPR_MEMBER size_type | bsl::span::extent = EXTENT |
static BSLS_KEYWORD_CONSTEXPR_MEMBER size_type | bsl::span< TYPE, dynamic_extent >::extent = dynamic_extent |
span
class template. bsl::span | C++03-compliant implementation of std::span . |
span
, that is a view over a contiguous sequence of objects. Note that if compiler supports the C++20 standard, then the std
implementation of span
is used. span
; one for statically sized
(i. e., size fixed at compile time) spans, and dynamically sized
(size can be altered at run-time). bsl::span
differs from std::span
in the following ways:
TYPE
, and we want to pass a subset of the array to a function, which is expecting some kind of a container. We can create a span
from the array, and then pass that. Since the span is a view
into the array, i.e, the span owns no storage, the elements in the span are the same as the ones in the array. template <class CONTAINER> void MakeEven(CONTAINER &c) // Make every value in the specified container 'c' even. { for (typename CONTAINER::iterator it = c.begin(); it != c.end(); ++it) { if (*it & 1) { *it ^= 1; } } }
MakeEven
to modify it. Afterwards, we check that none of the elements in the array that were not included in the span are unchanged, and the ones in the span were. int arr[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; bsl::span<int> sp(arr + 3, 4); // 4 elements, starting at 3. for (int i = 0; i < 10; ++i) { assert(arr[i] == i); } assert(sp[0] == 3); assert(sp[1] == 4); assert(sp[2] == 5); assert(sp[3] == 6); MakeEven(sp); assert(sp[0] == 2); // Has been changed assert(sp[1] == 4); assert(sp[2] == 4); // Has been changed assert(sp[3] == 6); assert(arr[0] == 0); // Not part of the span assert(arr[1] == 1); // Not part of the span assert(arr[2] == 2); // Not part of the span assert(arr[3] == 2); // Has been changed assert(arr[4] == 4); assert(arr[5] == 4); // Has been changed assert(arr[6] == 6); assert(arr[7] == 7); // Not part of the span assert(arr[8] == 8); // Not part of the span assert(arr[9] == 9); // Not part of the span
TYPE
, and we want to return a (contiguous) subset of the vector from a function, which can then be processed processed using a range-based for loop. To achieve that, we can use span
as the return type. The calling code can then interate over the span as if it was a container. Note that since the span doesn't own the elements of the vector, the span might become invalid when the vector is changed (or resized, or destroyed). span
. bsl::vector<int> v = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; bsl::span<const int> slice(const bsl::vector<int>& vec, size_t first, size_t last) // Return a span into the specified 'vec', starting at the specified // 'first' index, and continuing up to (but not including) the // specified 'last' index. { return bsl::span<const int>(vec.data() + first, last-first); }
bsl::span<const int> sp = slice(v, 4, 7); int val = 4; for (int x: sp) { assert(x == val++); }
sp
: val = 2; for (int x: slice(v, 2, 8)) { assert(x == val++); }
typedef bsl::remove_cv<TYPE>::type bsl::span< TYPE, EXTENT >::value_type [inherited] |
typedef size_t bsl::span< TYPE, EXTENT >::size_type [inherited] |
typedef ptrdiff_t bsl::span< TYPE, EXTENT >::difference_type [inherited] |
typedef TYPE* bsl::span< TYPE, EXTENT >::pointer [inherited] |
typedef const TYPE* bsl::span< TYPE, EXTENT >::const_pointer [inherited] |
typedef TYPE& bsl::span< TYPE, EXTENT >::reference [inherited] |
typedef const TYPE& bsl::span< TYPE, EXTENT >::const_reference [inherited] |
typedef pointer bsl::span< TYPE, EXTENT >::iterator [inherited] |
typedef bsl::reverse_iterator<iterator> bsl::span< TYPE, EXTENT >::reverse_iterator [inherited] |
typedef bsl::remove_cv<TYPE>::type bsl::span< TYPE, dynamic_extent >::value_type [inherited] |
typedef size_t bsl::span< TYPE, dynamic_extent >::size_type [inherited] |
typedef ptrdiff_t bsl::span< TYPE, dynamic_extent >::difference_type [inherited] |
typedef TYPE* bsl::span< TYPE, dynamic_extent >::pointer [inherited] |
typedef const TYPE* bsl::span< TYPE, dynamic_extent >::const_pointer [inherited] |
typedef TYPE& bsl::span< TYPE, dynamic_extent >::reference [inherited] |
typedef const TYPE& bsl::span< TYPE, dynamic_extent >::const_reference [inherited] |
typedef pointer bsl::span< TYPE, dynamic_extent >::iterator [inherited] |
typedef bsl::reverse_iterator<iterator> bsl::span< TYPE, dynamic_extent >::reverse_iterator [inherited] |
BSLS_KEYWORD_CONSTEXPR_CPP14 bsl::span< TYPE, EXTENT >::span | ( | ) | [inherited] |
Construct an empty span
object. The behavior is undefined unless 0 == EXTENT
BSLS_KEYWORD_CONSTEXPR_CPP14 bsl::span< TYPE, EXTENT >::span | ( | const span< TYPE, EXTENT > & | original | ) | [inherited] |
Create a span that refers to the same data as the specified original
object.
BSLS_KEYWORD_CONSTEXPR_CPP14 bsl::span< TYPE, EXTENT >::span | ( | pointer | ptr, | |
size_type | count | |||
) | [explicit, inherited] |
Construct a span that refers to the specified count
consecutive objects starting from the specified ptr
. The behavior is undefined unless EXTENT == count
.
BSLS_KEYWORD_CONSTEXPR_CPP14 bsl::span< TYPE, EXTENT >::span | ( | pointer | first, | |
pointer | last | |||
) | [explicit, inherited] |
Construct a span from the specified first
and specified last
. The behavior is undefined unless EXTENT == bsl::distance(first, last)
.
BSLS_KEYWORD_CONSTEXPR_CPP14 bsl::span< TYPE, EXTENT >::span | ( | typename Span_Utility::TypeIdentity< element_type >::type(&) | arr[SIZE] | ) | [inherited] |
Construct a span from the specified C-style array arr
. The behavior is undefined unless SIZE == EXTENT
.
BSLS_KEYWORD_CONSTEXPR_CPP14 bsl::span< TYPE, EXTENT >::span | ( | bsl::array< t_OTHER_TYPE, EXTENT > & | arr, | |
typename bsl::enable_if< Span_Utility::IsArrayConvertible< t_OTHER_TYPE, element_type >::value, void * >::type | = NULL | |||
) | [inherited] |
Construct a span from the specified bsl::array arr
. This constructor participates in overload resolution only if t_OTHER_TYPE(*)[]
is convertible to element_type(*)[]
.
BSLS_KEYWORD_CONSTEXPR_CPP14 bsl::span< TYPE, EXTENT >::span | ( | const bsl::array< t_OTHER_TYPE, EXTENT > & | arr, | |
typename bsl::enable_if< Span_Utility::IsArrayConvertible< const t_OTHER_TYPE, element_type >::value, void * >::type | = NULL | |||
) | [inherited] |
Construct a span from the specified bsl::array arr
. This constructor participates in overload resolution only if t_OTHER_TYPE(*)[]
is convertible to element_type(*)[]
.
BSLS_KEYWORD_CONSTEXPR_CPP14 bsl::span< TYPE, EXTENT >::span | ( | std::array< t_OTHER_TYPE, EXTENT > & | arr, | |
typename bsl::enable_if< Span_Utility::IsArrayConvertible< t_OTHER_TYPE, element_type >::value, void * >::type | = NULL | |||
) | [inherited] |
Construct a span from the specified std::array arr
. This constructor participates in overload resolution only if t_OTHER_TYPE(*)[]
is convertible to element_type(*)[]
.
BSLS_KEYWORD_CONSTEXPR_CPP14 bsl::span< TYPE, EXTENT >::span | ( | const std::array< t_OTHER_TYPE, EXTENT > & | arr, | |
typename bsl::enable_if< Span_Utility::IsArrayConvertible< const t_OTHER_TYPE, element_type >::value, void * >::type | = NULL | |||
) | [inherited] |
Construct a span from the specified std::array arr
. This constructor participates in overload resolution only if t_OTHER_TYPE(*)[]
is convertible to element_type(*)[]
.
BSLS_KEYWORD_CONSTEXPR_CPP14 bsl::span< TYPE, EXTENT >::span | ( | const span< t_OTHER_TYPE, EXTENT > & | other, | |
typename bsl::enable_if< Span_Utility::IsArrayConvertible< t_OTHER_TYPE, element_type >::value, void * >::type | = NULL | |||
) | [inherited] |
Construct a span from the specified span other
. This constructor participates in overload resolution only if t_OTHER_TYPE(*)[]
is convertible to element_type(*)[]
.
BSLS_KEYWORD_CONSTEXPR_CPP14 bsl::span< TYPE, EXTENT >::span | ( | const span< t_OTHER_TYPE, dynamic_extent > & | other, | |
typename bsl::enable_if< Span_Utility::IsArrayConvertible< t_OTHER_TYPE, element_type >::value, void * >::type | = NULL | |||
) | [inherited] |
Construct a span from the specified span other
. This constructor participates in overload resolution only if t_OTHER_TYPE(*)[]
is convertible to element_type(*)[]
. The behavior is undefined unless other.size() == EXTENT
.
BSLS_KEYWORD_CONSTEXPR_CPP14 reference bsl::span< TYPE, EXTENT >::back | ( | ) | const [inline, inherited] |
< Return a reference to the last element of this span. The behavior is undefined if this span is empty.
References BSLMF_ASSERT(), and bsl::span< TYPE, EXTENT >::size().
BSLS_KEYWORD_CONSTEXPR pointer bsl::span< TYPE, EXTENT >::data | ( | ) | const [inherited] |
Return a pointer to the data referenced by this span.
Referenced by bsl::span< TYPE, EXTENT >::subspan().
BSLS_KEYWORD_CONSTEXPR bool bsl::span< TYPE, EXTENT >::empty | ( | ) | const [inherited] |
Return true
if this span contains no elements and false
otherwise.
BSLS_KEYWORD_CONSTEXPR_CPP14 span<element_type, COUNT> bsl::span< TYPE, EXTENT >::first | ( | ) | const [inherited] |
Return a statically-sized span consisting of the first COUNT
elements of this span. The behavior is undefined unless COUNT <= size()
.
BSLS_KEYWORD_CONSTEXPR_CPP14 span<element_type, dynamic_extent> bsl::span< TYPE, EXTENT >::first | ( | size_type | count | ) | const [inherited] |
Return a dynamically-sized span consisting of the first (specified) count
elements of this span. The behavior is undefined unless count <= size()
.
BSLS_KEYWORD_CONSTEXPR_CPP14 reference bsl::span< TYPE, EXTENT >::front | ( | ) | const [inline, inherited] |
< Return a reference to the first element of this span. The behavior is undefined if this span is empty.
References BSLMF_ASSERT().
BSLS_KEYWORD_CONSTEXPR_CPP14 span<element_type, COUNT> bsl::span< TYPE, EXTENT >::last | ( | ) | const [inherited] |
Return a statically-sized span consisting of the last COUNT
elements of this span. The behavior is undefined unless COUNT <= size()
.
BSLS_KEYWORD_CONSTEXPR_CPP14 span<element_type, dynamic_extent> bsl::span< TYPE, EXTENT >::last | ( | size_type | count | ) | const [inherited] |
Return a dynamically-sized span consisting of the last (specified) count
elements of this span. The behavior is undefined unless count <= size()
.
BSLS_KEYWORD_CONSTEXPR size_type bsl::span< TYPE, EXTENT >::size | ( | ) | const [inline, inherited] |
< Return the size of this span.
Referenced by bsl::span< TYPE, EXTENT >::back(), bsl::span< TYPE, EXTENT >::operator[](), and bsl::span< TYPE, EXTENT >::subspan().
BSLS_KEYWORD_CONSTEXPR size_type bsl::span< TYPE, EXTENT >::size_bytes | ( | ) | const [inherited] |
Return the size of this span in bytes.
BSLS_KEYWORD_CONSTEXPR_CPP14 Span_Utility::SubspanReturnType<TYPE, EXTENT, COUNT, OFFSET>::type bsl::span< TYPE, EXTENT >::subspan | ( | ) | const [inline, inherited] |
< If the template parameter COUNT
is dynamic_extent
, return a dynamically-sized span consisting consisting of the elements of this span in the half-open range [OFFSET, EXTENT)
. Otherwise, return a statically-sized span consisting of the elements of this span in the half-open range [OFFSET, OFFSET+COUNT)
. The behavior is undefined unless OFFSET <= EXTENT
. If COUNT != dynamic_extent
, the behavior is undefined unless OFFSET + COUNT <= EXTENT
.
References BSLMF_ASSERT(), bsl::span< TYPE, EXTENT >::data(), bsl::dynamic_extent, and bsl::span< TYPE, EXTENT >::size().
BSLS_KEYWORD_CONSTEXPR_CPP14 span<element_type, dynamic_extent> bsl::span< TYPE, EXTENT >::subspan | ( | size_type | offset, | |
size_type | count = dynamic_extent | |||
) | const [inherited] |
Return a dynamically-sized span starting at the specified offset
. If the optionally specified count
is dynamic_extent
, the span will consist of the half-open range [offset, size () - offset)
and the behavior is undefined if offset > size()
. Otherwise, the span will consist of the half-open range [offset, count)
and the behavior is undefined if offset + count > size()
.
BSLS_KEYWORD_CONSTEXPR_CPP14 reference bsl::span< TYPE, EXTENT >::operator[] | ( | size_type | index | ) | const [inline, inherited] |
< Return a reference to the element at the specified index
. The behavior is undefined unless index < size()
.
References BSLS_ASSERT, and bsl::span< TYPE, EXTENT >::size().
BSLS_KEYWORD_CONSTEXPR_CPP14 iterator bsl::span< TYPE, EXTENT >::begin | ( | ) | const [inherited] |
Return an iterator providing modifiable access to the first element of this span, and the past-the-end iterator if this span is empty.
BSLS_KEYWORD_CONSTEXPR_CPP14 iterator bsl::span< TYPE, EXTENT >::end | ( | ) | const [inherited] |
Return the past-the-end iterator providing modifiable access to this span.
BSLS_KEYWORD_CONSTEXPR_CPP14 reverse_iterator bsl::span< TYPE, EXTENT >::rbegin | ( | ) | const [inherited] |
Return a reverse iterator providing modifiable access to the last element of this span, and the past-the-end reverse iterator if this span is empty.
BSLS_KEYWORD_CONSTEXPR_CPP14 reverse_iterator bsl::span< TYPE, EXTENT >::rend | ( | ) | const [inherited] |
Return the past-the-end reverse iterator providing modifiable access to this span.
BSLS_KEYWORD_CONSTEXPR_CPP14 span& bsl::span< TYPE, EXTENT >::operator= | ( | const span< TYPE, EXTENT > & | ) | [inherited] |
Assign to this span the value of the specified rhs
object, and return a reference providing modifiable access to this span.
BSLS_KEYWORD_CONSTEXPR_CPP14 void bsl::span< TYPE, EXTENT >::swap | ( | span< TYPE, EXTENT > & | other | ) | [inherited] |
Exchange the value of this span with the value of the specified other
object.
BSLS_KEYWORD_CONSTEXPR_CPP14 bsl::span< TYPE, dynamic_extent >::span | ( | ) | [inherited] |
Construct an empty span
object.
BSLS_KEYWORD_CONSTEXPR_CPP14 bsl::span< TYPE, dynamic_extent >::span | ( | const span< TYPE, dynamic_extent > & | original | ) | [inherited] |
Create a span that refers to the same data as the specified original
object.
BSLS_KEYWORD_CONSTEXPR_CPP14 bsl::span< TYPE, dynamic_extent >::span | ( | pointer | ptr, | |
size_type | count | |||
) | [inherited] |
Construct a span that refers to the specified count
consecutive objects starting from the specified ptr
.
BSLS_KEYWORD_CONSTEXPR_CPP14 bsl::span< TYPE, dynamic_extent >::span | ( | pointer | first, | |
pointer | last | |||
) | [inherited] |
Construct a span from the specified first
and specified last
.
BSLS_KEYWORD_CONSTEXPR_CPP14 bsl::span< TYPE, dynamic_extent >::span | ( | typename Span_Utility::TypeIdentity< element_type >::type(&) | arr[SIZE] | ) | [inherited] |
Construct a span from the specified C-style array arr
.
BSLS_KEYWORD_CONSTEXPR_CPP14 bsl::span< TYPE, dynamic_extent >::span | ( | bsl::array< t_OTHER_TYPE, SIZE > & | arr, | |
typename bsl::enable_if< Span_Utility::IsArrayConvertible< t_OTHER_TYPE, element_type >::value, void * >::type | = NULL | |||
) | [inherited] |
Construct a span from the specified bsl::array arr
. This constructor participates in overload resolution only if t_OTHER_TYPE(*)[]
is convertible to element_type(*)[]
.
BSLS_KEYWORD_CONSTEXPR_CPP14 bsl::span< TYPE, dynamic_extent >::span | ( | const bsl::array< t_OTHER_TYPE, SIZE > & | arr, | |
typename bsl::enable_if< Span_Utility::IsArrayConvertible< const t_OTHER_TYPE, element_type >::value, void * >::type | = NULL | |||
) | [inherited] |
Construct a span from the specified bsl::array arr
. This constructor participates in overload resolution only if t_OTHER_TYPE(*)[]
is convertible to element_type(*)[]
.
BSLS_KEYWORD_CONSTEXPR_CPP14 bsl::span< TYPE, dynamic_extent >::span | ( | std::array< t_OTHER_TYPE, SIZE > & | arr, | |
typename bsl::enable_if< Span_Utility::IsArrayConvertible< t_OTHER_TYPE, element_type >::value, void * >::type | = NULL | |||
) | [inherited] |
Construct a span from the specified std::array arr
. This constructor participates in overload resolution only if t_OTHER_TYPE(*)[]
is convertible to element_type(*)[]
.
BSLS_KEYWORD_CONSTEXPR_CPP14 bsl::span< TYPE, dynamic_extent >::span | ( | const std::array< t_OTHER_TYPE, SIZE > & | arr, | |
typename bsl::enable_if< Span_Utility::IsArrayConvertible< const t_OTHER_TYPE, element_type >::value, void * >::type | = NULL | |||
) | [inherited] |
Construct a span from the specified std::array arr
. This constructor participates in overload resolution only if t_OTHER_TYPE(*)[]
is convertible to element_type(*)[]
.
BSLS_KEYWORD_CONSTEXPR_CPP14 bsl::span< TYPE, dynamic_extent >::span | ( | CONTAINER & | c, | |
typename bsl::enable_if< Span_Utility::IsSpanCompatibleContainer< CONTAINER, TYPE >::value, void * >::type | = NULL | |||
) | [inline, inherited] |
BSLS_KEYWORD_CONSTEXPR_CPP14 bsl::span< TYPE, dynamic_extent >::span | ( | const CONTAINER & | c, | |
typename bsl::enable_if< Span_Utility::IsSpanCompatibleContainer< const CONTAINER, TYPE >::value, void * >::type | = NULL | |||
) | [inline, inherited] |
BSLS_KEYWORD_CONSTEXPR_CPP14 bsl::span< TYPE, dynamic_extent >::span | ( | const span< t_OTHER_TYPE, OTHER_EXTENT > & | other, | |
typename bsl::enable_if< Span_Utility::IsArrayConvertible< t_OTHER_TYPE, element_type >::value, void * >::type | = NULL | |||
) | [inherited] |
Construct a span from the specified span other
. This constructor participates in overload resolution only if t_OTHER_TYPE(*)[]
is convertible to element_type(*)[]
.
BSLS_KEYWORD_CONSTEXPR_CPP14 reference bsl::span< TYPE, dynamic_extent >::back | ( | ) | const [inherited] |
Return a reference to the last element of this span. The behavior is undefined if this span is empty.
BSLS_KEYWORD_CONSTEXPR pointer bsl::span< TYPE, dynamic_extent >::data | ( | ) | const [inherited] |
Return a pointer to the data referenced by this span.
BSLS_KEYWORD_CONSTEXPR bool bsl::span< TYPE, dynamic_extent >::empty | ( | ) | const [inherited] |
Return true
if size() == 0
and false
otherwise.
BSLS_KEYWORD_CONSTEXPR_CPP14 span<element_type, COUNT> bsl::span< TYPE, dynamic_extent >::first | ( | ) | const [inherited] |
Return a statically-sized span consisting of the first COUNT
elements of this span. The behavior is undefined unless COUNT <= size()
.
BSLS_KEYWORD_CONSTEXPR_CPP14 span<element_type, dynamic_extent> bsl::span< TYPE, dynamic_extent >::first | ( | size_type | count | ) | const [inherited] |
Return a dynamically-sized span consisting of the first (specified) count
elements of this span. The behavior is undefined unless count <= size()
.
BSLS_KEYWORD_CONSTEXPR_CPP14 reference bsl::span< TYPE, dynamic_extent >::front | ( | ) | const [inherited] |
Return a reference to the first element of this span. The behavior is undefined if this span is empty.
BSLS_KEYWORD_CONSTEXPR_CPP14 span<element_type, COUNT> bsl::span< TYPE, dynamic_extent >::last | ( | ) | const [inherited] |
Return a statically-sized span consisting of the last COUNT
elements of this span. The behavior is undefined unless COUNT <= size()
.
BSLS_KEYWORD_CONSTEXPR_CPP14 span<element_type, dynamic_extent> bsl::span< TYPE, dynamic_extent >::last | ( | size_type | count | ) | const [inherited] |
Return a dynamically-sized span consisting of the last (specified) count
elements of this span. The behavior is undefined unless count <= size()
.
BSLS_KEYWORD_CONSTEXPR size_type bsl::span< TYPE, dynamic_extent >::size | ( | ) | const [inherited] |
Return the size of this span.
BSLS_KEYWORD_CONSTEXPR size_type bsl::span< TYPE, dynamic_extent >::size_bytes | ( | ) | const [inherited] |
Return the size of this span in bytes.
BSLS_KEYWORD_CONSTEXPR_CPP14 span<element_type, COUNT> bsl::span< TYPE, dynamic_extent >::subspan | ( | ) | const [inherited] |
Return a dynamically-sized span consisting of the COUNT
elements of this span starting at OFFSET
. The behavior is undefined unless COUNT + OFFSET <= size()
.
BSLS_KEYWORD_CONSTEXPR_CPP14 span<element_type, dynamic_extent> bsl::span< TYPE, dynamic_extent >::subspan | ( | size_type | offset, | |
size_type | count = dynamic_extent | |||
) | const [inherited] |
Return a dynamically-sized span starting at the specified offset
. If the optionally specified count
is dynamic_extent
, the span will consist of the half-open range [offset, size () - offset)
and the behavior is undefined unless offset <= size()
. Otherwise, the span will consist of the half-open range [offset, count)
and the behavior is undefined unless offset + count <= size()
.
BSLS_KEYWORD_CONSTEXPR_CPP14 reference bsl::span< TYPE, dynamic_extent >::operator[] | ( | size_type | index | ) | const [inherited] |
Return a reference to the element at the specified index
. The behavior is undefined unless index < size()
.
BSLS_KEYWORD_CONSTEXPR_CPP14 iterator bsl::span< TYPE, dynamic_extent >::begin | ( | ) | const [inherited] |
Return an iterator providing modifiable access to the first element of this span, and the past-the-end iterator if this span is empty.
BSLS_KEYWORD_CONSTEXPR_CPP14 iterator bsl::span< TYPE, dynamic_extent >::end | ( | ) | const [inherited] |
Return the past-the-end iterator providing modifiable access to this span.
BSLS_KEYWORD_CONSTEXPR_CPP14 reverse_iterator bsl::span< TYPE, dynamic_extent >::rbegin | ( | ) | const [inherited] |
Return a reverse iterator providing modifiable access to the last element of this span, and the past-the-end reverse iterator if this span is empty.
BSLS_KEYWORD_CONSTEXPR_CPP14 reverse_iterator bsl::span< TYPE, dynamic_extent >::rend | ( | ) | const [inherited] |
Return the past-the-end reverse iterator providing modifiable access to this span.
BSLS_KEYWORD_CONSTEXPR_CPP14 span& bsl::span< TYPE, dynamic_extent >::operator= | ( | const span< TYPE, dynamic_extent > & | rhs | ) | [inline, inherited] |
< Assign to this span the value of the specified rhs
object, and return a reference providing modifiable access to this span.
BSLS_KEYWORD_CONSTEXPR_CPP14 void bsl::span< TYPE, dynamic_extent >::swap | ( | span< TYPE, dynamic_extent > & | other | ) | [inherited] |
Exchange the value of this span with the value of the specified other
object.
BSLS_KEYWORD_CONSTEXPR_CPP14 span<const std::byte, EXTENT * sizeof(TYPE)> bsl::as_bytes | ( | span< TYPE, EXTENT > | s | ) |
Return a span referring to to same data as the specified s
, but referring to the data as a span of non-modifiable bytes.
BSLS_KEYWORD_CONSTEXPR_CPP14 span<const std::byte, dynamic_extent> bsl::as_bytes | ( | span< TYPE, dynamic_extent > | s | ) |
Return a span referring to to same data as the specified s
, but referring to the data as a span of non-modifiable bytes.
BSLS_KEYWORD_CONSTEXPR_CPP14 span<std::byte, EXTENT * sizeof(TYPE)> bsl::as_writable_bytes | ( | span< TYPE, EXTENT > | s | ) |
Return a span referring to to same data as the specified s
, but referring to the data as a span of modifiable bytes.
BSLS_KEYWORD_CONSTEXPR_CPP14 span<std::byte, dynamic_extent> bsl::as_writable_bytes | ( | span< TYPE, dynamic_extent > | s | ) |
Return a span referring to to same data as the specified s
, but referring to the data as a span of modifiable bytes.
BSLS_KEYWORD_CONSTEXPR_CPP14 void bsl::swap | ( | span< TYPE, EXTENT > & | a, | |
span< TYPE, EXTENT > & | b | |||
) |
Exchange the value of the specified a
object with the value of the specified b
object.
BSLS_KEYWORD_CONSTEXPR_MEMBER size_type bsl::span< TYPE, EXTENT >::extent = EXTENT [static, inherited] |
BSLS_KEYWORD_CONSTEXPR_MEMBER size_type bsl::span< TYPE, dynamic_extent >::extent = dynamic_extent [static, inherited] |