|
constexpr | Span () noexcept |
|
template<typename T , typename std::enable_if< std::is_convertible< T(*)[], C(*)[]>::value, int >::type = 0> |
constexpr | Span (T *begin, std::size_t size) noexcept |
| Construct a span from a begin pointer and a size. More...
|
|
template<typename T , typename std::enable_if< std::is_convertible< T(*)[], C(*)[]>::value, int >::type = 0> |
CONSTEXPR_IF_NOT_DEBUG | Span (T *begin, T *end) noexcept |
| Construct a span from a begin and end pointer. More...
|
|
template<typename O , typename std::enable_if< std::is_convertible< O(*)[], C(*)[]>::value, int >::type = 0> |
constexpr | Span (const Span< O > &other) noexcept |
| Implicit conversion of spans between compatible types. More...
|
|
constexpr | Span (const Span &) noexcept=default |
| Default copy constructor. More...
|
|
Span & | operator= (const Span &other) noexcept=default |
| Default assignment operator. More...
|
|
template<int N> |
constexpr | Span (C(&a)[N]) noexcept |
| Construct a Span from an array. More...
|
|
template<typename V , typename std::enable_if<(std::is_const< C >::value||std::is_lvalue_reference< V >::value) &&std::is_convertible< typename std::remove_pointer< decltype(std::declval< V &>().data())>::type(*)[], C(*)[]>::value &&std::is_convertible< decltype(std::declval< V &>().size()), std::size_t >::value, int >::type = 0> |
constexpr | Span (V &&v) noexcept |
| Construct a Span for objects with .data() and .size() (std::string, std::array, std::vector, ...). More...
|
|
constexpr C * | data () const noexcept |
|
constexpr C * | begin () const noexcept |
|
constexpr C * | end () const noexcept |
|
CONSTEXPR_IF_NOT_DEBUG C & | front () const noexcept |
|
CONSTEXPR_IF_NOT_DEBUG C & | back () const noexcept |
|
constexpr std::size_t | size () const noexcept |
|
CONSTEXPR_IF_NOT_DEBUG C & | operator[] (std::size_t pos) const noexcept |
|
CONSTEXPR_IF_NOT_DEBUG Span< C > | subspan (std::size_t offset) const noexcept |
|
CONSTEXPR_IF_NOT_DEBUG Span< C > | subspan (std::size_t offset, std::size_t count) const noexcept |
|
CONSTEXPR_IF_NOT_DEBUG Span< C > | first (std::size_t count) const noexcept |
|
CONSTEXPR_IF_NOT_DEBUG Span< C > | last (std::size_t count) const noexcept |
|
template<typename C>
class Span< C >
A Span is an object that can refer to a contiguous sequence of objects.
It implements a subset of C++20's std::span.
Definition at line 27 of file span.h.
template<typename C>
template<typename T , typename std::enable_if< std::is_convertible< T(*)[], C(*)[]>::value, int >::type = 0>
constexpr Span< C >::Span |
( |
T * |
begin, |
|
|
std::size_t |
size |
|
) |
| |
|
inlinenoexcept |
Construct a span from a begin pointer and a size.
This implements a subset of the iterator-based std::span constructor in C++20, which is hard to implement without std::address_of.
Definition at line 43 of file span.h.
template<typename C>
template<typename T , typename std::enable_if< std::is_convertible< T(*)[], C(*)[]>::value, int >::type = 0>
Construct a span from a begin and end pointer.
This implements a subset of the iterator-based std::span constructor in C++20, which is hard to implement without std::address_of.
Definition at line 55 of file span.h.
template<typename C>
template<typename O , typename std::enable_if< std::is_convertible< O(*)[], C(*)[]>::value, int >::type = 0>
Implicit conversion of spans between compatible types.
Specifically, if a pointer to an array of type O can be implicitly converted to a pointer to an array of type C, then permit implicit conversion of Span<O> to Span<C>. This matches the behavior of the corresponding C++20 std::span constructor.
For example this means that a Span<T> can be converted into a Span<const t>="">.
Definition at line 74 of file span.h.
template<typename C>
template<typename V , typename std::enable_if<(std::is_const< C >::value||std::is_lvalue_reference< V >::value) &&std::is_convertible< typename std::remove_pointer< decltype(std::declval< V &>().data())>::type(*)[], C(*)[]>::value &&std::is_convertible< decltype(std::declval< V &>().size()), std::size_t >::value, int >::type = 0>
Construct a Span for objects with .data() and .size() (std::string, std::array, std::vector, ...).
This implements a subset of the functionality provided by the C++20 std::span range-based constructor.
To prevent surprises, only Spans for constant value types are supported when passing in temporaries. Note that this restriction does not exist when converting arrays or other Spans (see above).
Definition at line 110 of file span.h.