![]() |
ATLAS Offline Software
|
Simplified version of the C++20 std::span. More...
#include <span.h>
Public Types | |
| using | element_type = T |
| Required typedefs. More... | |
| using | value_type = std::remove_cv_t< T > |
| using | size_type = std::size_t |
| using | difference_type = std::ptrdiff_t |
| using | pointer = T * |
| using | const_pointer = const T * |
| using | reference = element_type & |
| using | const_reference = const element_type & |
| using | iterator = pointer |
| using | const_iterator = const_pointer |
| using | reverse_iterator = std::reverse_iterator< iterator > |
| using | const_reverse_iterator = std::reverse_iterator< const_iterator > |
Public Member Functions | |
| span () | |
| template<class U > | |
| requires (valid_span_type_v< T, U >) span(U *ptr | |
| Constructor from start and length. More... | |
| template<class U > | |
| requires (valid_span_type_v< T, U >) span(U *beg | |
| Constructor from start and end. More... | |
| span (const span &)=default | |
| span & | operator= (const span &)=default |
| template<class U > | |
| requires (valid_span_type_v< T, U >) span(const span< U > &other) | |
| Constructor from another span. More... | |
| constexpr size_type | size () const noexcept |
| Return the size of the span. More... | |
| constexpr size_type | size_bytes () const noexcept |
| Return the size of contents of the span, in bytes. More... | |
| constexpr bool | empty () const noexcept |
| Test if the span is empty. More... | |
| constexpr reference | front () noexcept |
| Return a reference to the first element in the span. More... | |
| constexpr const_reference | front () const noexcept |
| Return a reference to the first element in the span. More... | |
| constexpr reference | back () noexcept |
| Return a reference to the last element in the span. More... | |
| constexpr const_reference | back () const noexcept |
| Return a reference to the last element in the span. More... | |
| constexpr reference | operator[] (size_type i) noexcept |
| Return a reference to the i-th element in the span. More... | |
| constexpr const_reference | operator[] (size_type i) const noexcept |
| Return a reference to the i-th element in the span. More... | |
| constexpr reference | at (size_type i) |
| Return a reference to the i-th element in the span (bounds-checked). More... | |
| constexpr const_reference | at (size_type i) const |
| Return a reference to the i-th element in the span (bounds-checked). More... | |
| constexpr pointer | data () noexcept |
| Return a pointer to the start of the span. More... | |
| constexpr const_pointer | data () const noexcept |
| Return a pointer to the start of the span. More... | |
| constexpr iterator | begin () noexcept |
| Return a begin iterator. More... | |
| constexpr const_iterator | begin () const noexcept |
| Return a begin iterator. More... | |
| constexpr iterator | end () noexcept |
| Return an end iterator. More... | |
| constexpr const_iterator | end () const noexcept |
| Return an end iterator. More... | |
| constexpr reverse_iterator | rbegin () noexcept |
| Return a begin reverse iterator. More... | |
| constexpr const_reverse_iterator | rbegin () const noexcept |
| Return a begin reverse iterator. More... | |
| constexpr reverse_iterator | rend () noexcept |
| Return an end reverse iterator. More... | |
| constexpr const_reverse_iterator | rend () const noexcept |
| Return an end reverse iterator. More... | |
| constexpr span | first (size_type n) noexcept |
| Return a subspan from the start. More... | |
| constexpr span< const T > | first (size_type n) const noexcept |
| Return a subspan from the start. More... | |
| constexpr span | last (size_type n) noexcept |
| Return a subspan from the end. More... | |
| constexpr span< const T > | last (size_type n) const noexcept |
| Return a subspan from the end. More... | |
| constexpr span | subspan (size_type offs, size_type n=dynamic_extent) noexcept |
| Return a subspan. More... | |
| constexpr span< const T > | subspan (size_type offs, size_type n=dynamic_extent) const noexcept |
| Return a subspan. More... | |
Public Attributes | |
| size_type | sz |
| U * | end |
Private Attributes | |
| T * | m_ptr |
| Pointer to the start of the span. More... | |
| size_t | m_size |
| Number of elements in the span. More... | |
Simplified version of the C++20 std::span.
This class is meant to be very similar to the C++20 std::span class. There are however a few differences.
Contact the core sw group if any of these are a problem.
In addition:
| using CxxUtils::span< T >::const_iterator = const_pointer |
| using CxxUtils::span< T >::const_pointer = const T* |
| using CxxUtils::span< T >::const_reference = const element_type& |
| using CxxUtils::span< T >::const_reverse_iterator = std::reverse_iterator<const_iterator> |
| using CxxUtils::span< T >::difference_type = std::ptrdiff_t |
| using CxxUtils::span< T >::element_type = T |
| using CxxUtils::span< T >::iterator = pointer |
| using CxxUtils::span< T >::pointer = T* |
| using CxxUtils::span< T >::reference = element_type& |
| using CxxUtils::span< T >::reverse_iterator = std::reverse_iterator<iterator> |
| using CxxUtils::span< T >::size_type = std::size_t |
| using CxxUtils::span< T >::value_type = std::remove_cv_t<T> |
| CxxUtils::span< T >::span | ( | ) |
|
default |
|
constexpr |
Return a reference to the i-th element in the span (bounds-checked).
/
| i | Index of the element to return. |
|
constexpr |
Return a reference to the i-th element in the span (bounds-checked).
/
| i | Index of the element to return. |
|
constexprnoexcept |
Return a reference to the last element in the span.
|
constexprnoexcept |
Return a reference to the last element in the span.
|
constexprnoexcept |
Return a begin iterator.
|
constexprnoexcept |
Return a begin iterator.
|
constexprnoexcept |
Return a pointer to the start of the span.
|
constexprnoexcept |
Return a pointer to the start of the span.
|
constexprnoexcept |
Test if the span is empty.
|
constexprnoexcept |
Return an end iterator.
|
constexprnoexcept |
Return an end iterator.
|
constexprnoexcept |
Return a subspan from the start.
| n | Number of elements in the subspan. |
|
constexprnoexcept |
Return a subspan from the start.
| n | Number of elements in the subspan. |
|
constexprnoexcept |
Return a reference to the first element in the span.
|
constexprnoexcept |
Return a reference to the first element in the span.
|
constexprnoexcept |
Return a subspan from the end.
| n | Number of elements in the subspan. |
|
constexprnoexcept |
Return a subspan from the end.
| n | Number of elements in the subspan. |
|
default |
|
constexprnoexcept |
Return a reference to the i-th element in the span.
| i | Index of the element to return. |
|
constexprnoexcept |
Return a reference to the i-th element in the span.
| i | Index of the element to return. |
|
constexprnoexcept |
Return a begin reverse iterator.
|
constexprnoexcept |
Return a begin reverse iterator.
|
constexprnoexcept |
Return an end reverse iterator.
|
constexprnoexcept |
Return an end reverse iterator.
| CxxUtils::span< T >::requires | ( | valid_span_type_v< T, U > | ) | const & |
Constructor from another span.
| other | Span to copy from. |
Constructor from start and end.
| beg | Start of the span. |
| end | One past the end of the span. |
Constructor from start and length.
| ptr | Start of the span. |
| sz | Length of the span. |
|
constexprnoexcept |
Return the size of the span.
|
constexprnoexcept |
Return the size of contents of the span, in bytes.
|
constexprnoexcept |
Return a subspan.
| offs | Starting element of the subspan. |
| n | Number of elements in the subspan. If defaulted, take all remaining elements. |
|
constexprnoexcept |
Return a subspan.
| offs | Starting element of the subspan. |
| n | Number of elements in the subspan. If defaulted, take all remaining elements. |
| U* CxxUtils::span< T >::end |
|
private |
|
private |
| size_type CxxUtils::span< T >::sz |
1.8.18