#include <bn_span.h>
template<typename Type>
span class
std::span
like container.
Template parameters | |
---|---|
Type | Element type. |
It doesn't throw exceptions. Instead, asserts are used to ensure valid usage.
Public types
- using value_type = Type
- Value type alias.
- using size_type = int
- Size type alias.
- using difference_type = int
- Difference type alias.
- using reference = Type&
- Reference alias.
- using const_reference = const Type&
- Const reference alias.
- using pointer = Type*
- Pointer alias.
- using const_pointer = const Type*
- Const pointer alias.
- using iterator = Type*
- Iterator alias.
- using const_iterator = const Type*
- Const iterator alias.
- using reverse_iterator = bn::reverse_iterator<iterator>
- Reverse iterator alias.
-
using const_reverse_iterator = bn::reverse_iterator<const_
iterator> - Const reverse iterator alias.
Constructors, destructors, conversion operators
- span() defaulted constexpr
- Constructs an empty span.
-
span(pointer ptr,
size_
type size) constexpr - Constructs a span that is a view over the range [ptr, ptr + size).
- span(pointer first, pointer last) constexpr
- Constructs a span that is a view over the range [first, last).
-
template<size_span(value_
type ArraySize> type(&array)[ArraySize]) constexpr - Constructs a span that is a view over the given array.
-
template<class OtherType, size_span(const array<OtherType, ArraySize>& array) constexpr
type ArraySize> - Constructs a span that is a const view over the given bn::
array. -
template<class OtherType, size_span(array<OtherType, ArraySize>& array) constexpr
type ArraySize> - Constructs a span that is a non-const view over the given bn::
array. -
template<class OtherType>span(const span<OtherType>& other) constexpr
- Constructs a span that is a view over a span of another type.
Public functions
-
auto data() const -> const_
pointer constexpr - Returns a const pointer to the beginning of the referenced data.
- auto data() -> pointer constexpr
- Returns a pointer to the beginning of the referenced data.
-
auto size() const -> size_
type constexpr - Returns the number of referenced elements.
-
auto size_bytes() const -> size_
type constexpr - Returns the number of referenced bytes.
- auto empty() const -> bool constexpr
- Indicates if it doesn't reference any element.
-
auto begin() const -> const_
iterator constexpr - Returns a const iterator to the beginning of the span.
- auto begin() -> iterator constexpr
- Returns an iterator to the beginning of the span.
-
auto cbegin() const -> const_
iterator constexpr - Returns a const iterator to the beginning of the span.
-
auto end() const -> const_
iterator constexpr - Returns a const iterator to the end of the span.
- auto end() -> iterator constexpr
- Returns an iterator to the end of the span.
-
auto cend() const -> const_
iterator constexpr - Returns a const iterator to the end of the span.
-
auto rbegin() const -> const_
reverse_ iterator constexpr - Returns a const reverse iterator to the end of the span.
-
auto rbegin() -> reverse_
iterator constexpr - Returns a reverse iterator to the end of the span.
-
auto crbegin() const -> const_
reverse_ iterator constexpr - Returns a const reverse iterator to the end of the span.
-
auto rend() const -> const_
reverse_ iterator constexpr - Returns a const reverse iterator to the begin of the span.
-
auto rend() -> reverse_
iterator constexpr - Returns a reverse iterator to the begin of the span.
-
auto crend() const -> const_
reverse_ iterator constexpr - Returns a const reverse iterator to the begin of the span.
-
auto front() const -> const_
reference constexpr - Returns a const reference to the first element.
- auto front() -> reference constexpr
- Returns a reference to the first element.
-
auto back() const -> const_
reference constexpr - Returns a const reference to the last element.
- auto back() -> reference constexpr
- Returns a reference to the last element.
-
auto operator[](size_
type index) const -> const_ reference constexpr - Returns a const reference to the value stored at the specified index.
-
auto operator[](size_
type index) -> reference constexpr - Returns a reference to the value stored at the specified index.
-
auto at(size_
type index) const -> const_ reference constexpr - Returns a const reference to the value stored at the specified index.
-
auto at(size_
type index) -> reference constexpr - Returns a reference to the value stored at the specified index.
-
auto first(size_
type count) const -> span constexpr - Returns a span that is a view over the first count elements of this span.
-
auto last(size_
type count) const -> span constexpr - Returns a span that is a view over the last count elements of this span.
-
auto subspan(size_
type offset) const -> span constexpr - Returns a span that is a view over the elements of this span starting at offset.
-
auto subspan(size_
type offset, size_ type count) const -> span constexpr - Obtains a span that is a view over the count elements of this span starting at offset.
- void swap(span& other) constexpr
- Exchanges the contents of this span with those of the other one.
Friends
- void swap(span& a, span& b) constexpr
- Exchanges the contents of a span with those of another one.
- auto operator==(const span& a, const span& b) -> bool constexpr
- Equal operator.
- auto operator<(const span& a, const span& b) -> bool constexpr
- Less than operator.
- auto operator>(const span& a, const span& b) -> bool constexpr
- Greater than operator.
- auto operator<=(const span& a, const span& b) -> bool constexpr
- Less than or equal operator.
- auto operator>=(const span& a, const span& b) -> bool constexpr
- Greater than or equal operator.
Function documentation
template<typename Type>
bool operator==(const span& a,
const span& b) constexpr
Equal operator.
Parameters | |
---|---|
a | First span to compare. |
b | Second span to compare. |
Returns | true if the first span is equal to the second one, otherwise false . |
template<typename Type>
bool operator<=(const span& a,
const span& b) constexpr
Less than or equal operator.
Parameters | |
---|---|
a | First span to compare. |
b | Second span to compare. |
Returns | true if the first span is lexicographically less than or equal to the second one, otherwise false . |
template<typename Type>
bool operator>=(const span& a,
const span& b) constexpr
Greater than or equal operator.
Parameters | |
---|---|
a | First span to compare. |
b | Second span to compare. |
Returns | true if the first span is lexicographically greater than or equal to the second one, otherwise false . |