#include <span.h>
Public Member Functions | |
template<class It , enable_if_t< contiguous_iterator< It > &&Internal::is_array_convertible< remove_reference_t< iter_reference_t< It > >, T > &&Extent==dynamic_extent > * = nullptr> | |
constexpr | span (It first, size_type length) |
template<class It , enable_if_t< contiguous_iterator< It > &&Internal::is_array_convertible< remove_reference_t< iter_reference_t< It > >, T > &&Extent !=dynamic_extent, int > = 0> | |
constexpr | span (It first, size_type length) |
template<class It , class End , enable_if_t< contiguous_iterator< It > &&Internal::is_array_convertible< remove_reference_t< iter_reference_t< It > >, T > &&sized_sentinel_for< End, It > &&Extent==dynamic_extent > * = nullptr> | |
constexpr | span (It first, End last) |
template<class It , class End , enable_if_t< contiguous_iterator< It > &&Internal::is_array_convertible< remove_reference_t< iter_reference_t< It > >, T > &&sized_sentinel_for< End, It > &&Extent !=dynamic_extent, int > = 0> | |
constexpr | span (It first, End last) |
template<size_t N, class = enable_if_t<extent == dynamic_extent || N == Extent>> | |
constexpr | span (type_identity_t< element_type >(&arr)[N]) noexcept |
template<class U , size_t N, class = enable_if_t<(extent == dynamic_extent || N == Extent) && is_convertible_v<U, T>>> | |
constexpr | span (array< U, N > &data) noexcept |
template<class U , size_t N, class = enable_if_t<(extent == dynamic_extent || N == Extent) && is_convertible_v<U, T>>> | |
constexpr | span (const array< U, N > &data) noexcept |
template<class R , class = enable_if_t<ranges::contiguous_range<R> && ranges::sized_range<R> && (ranges::borrowed_range<R> || is_const_v<element_type>) && !Internal::is_std_span<remove_cvref_t<R>> && !Internal::is_std_array<remove_cvref_t<R>> && !is_array_v<remove_cvref_t<R>> && Internal::is_array_convertible<remove_reference_t<ranges::range_reference_t<R>>, element_type> >> | |
constexpr | span (R &&r) |
template<class U , size_t OtherExtent, class = enable_if_t< (extent == dynamic_extent || OtherExtent == dynamic_extent || extent == OtherExtent) && Internal::is_array_convertible<U, element_type> >> | |
constexpr | span (const span< U, OtherExtent > &other) |
constexpr | span (const span &) noexcept=default |
constexpr span & | operator= (const span &other)=default |
template<size_t Count> | |
constexpr span< element_type, Count > | first () const |
template<size_t Count> | |
constexpr span< element_type, Count > | last () const |
template<size_t Offset, size_t Count = dynamic_extent> | |
constexpr auto | subspan () const |
constexpr span< element_type, dynamic_extent > | first (size_type count) const |
constexpr span< element_type, dynamic_extent > | last (size_type count) const |
constexpr span< element_type, dynamic_extent > | subspan (size_type offset, size_type count=dynamic_extent) const |
constexpr size_type | size () const noexcept |
constexpr size_type | size_bytes () const noexcept |
constexpr bool | empty () const noexcept |
constexpr reference | operator[] (size_type index) const |
constexpr reference | front () const |
constexpr reference | back () const |
constexpr pointer | data () const noexcept |
constexpr iterator | begin () const noexcept |
constexpr iterator | end () const noexcept |
constexpr reverse_iterator | rbegin () const noexcept |
constexpr reverse_iterator | rend () const noexcept |
template<size_t Count> | |
constexpr auto | first () const -> span< element_type, Count > |
template<size_t Count> | |
constexpr auto | last () const -> span< element_type, Count > |
Static Public Attributes | |
static constexpr size_t | extent = Extent |
Full C++20 implementation of span done using the C++ draft at https://eel.is/c++draft/views. It does not maintain storage for the data, but just hold a pointer to mark the beginning and the size for the elements. It can be constructed any type that models the C++ contiguous_range concept such like array, vector, fixed_vector, raw-array, string_view, string, etc... .
Example: Given "void Func(AZStd::span<int> a) {...}" you can call...
Since the span does not copy and store any data, it is only valid as long as the data used to create it is valid.