Represents a non-owning view over a contiguous sequence of objects.
const type_t: Create a span over an array.
Public Aliases | |
| using | element_type |
| Represents the span elemeent type. | |
| using | value_type |
| Represents the span value type. | |
| using | size_type |
| Represents the span size type (usually xtd::size). | |
| using | difference_type |
| Represents the span difference type (usually xtd::ptrdiff). | |
| using | pointer |
| Represents the span pointer type. | |
| using | const_pointer |
| Represents the span const pointer type. | |
| using | reference |
| Represents the span reference type. | |
| using | const_reference |
| Represents the span const reference type. | |
| using | iterator |
| Represents the iterator of span value type. | |
| using | const_iterator |
| Represents the const iterator of span value type. | |
| using | reverse_iterator |
| Represents the reverse iterator of span value type. | |
| using | const_reverse_iterator |
| Represents the const reverse iterator of span value type. | |
Public Properties | |
| static const span | empty_span |
| Returns an empty xtd::span <type_t> object. | |
| const_reference | back () const |
| Gets the last element. | |
| const_iterator | begin () const |
| Returns an iterator to the beginning. | |
| iterator | begin () |
| Returns an iterator to the beginning. | |
| const_iterator | cbegin () const |
| Returns an iterator to the beginning. | |
| const_iterator | cend () const |
| Returns an iterator to the end. | |
| const_reverse_iterator | crbegin () const |
| Returns a reverse iterator to the beginning. | |
| const_reverse_iterator | crend () const |
| Returns a reverse iterator to the end. | |
| constexpr const_pointer | data () const noexcept |
| Gets direct access to the underlying contiguous storage. | |
| constexpr bool | empty () const noexcept |
| Returns a value that indicates whether the current xtd::span <type_t> is empty. | |
| const_iterator | end () const |
| Returns an iterator to the end. | |
| iterator | end () |
| Returns an iterator to the end. | |
| const_reference | front () const |
| Gets the first element. | |
| constexpr bool | is_empty () const noexcept |
| Returns a value that indicates whether the current xtd::span <type_t> is empty. | |
| constexpr size_type | length () const noexcept |
| Returns the length of the current span. | |
| const_reverse_iterator | rbegin () const |
| Returns a reverse iterator to the beginning. | |
| reverse_iterator | rbegin () |
| Returns a reverse iterator to the beginning. | |
| const_reverse_iterator | rend () const |
| Returns a reverse iterator to the end. | |
| reverse_iterator | rend () |
| Returns a reverse iterator to the end. | |
| constexpr size_type | size () const noexcept |
| Returns the number of elements. | |
| constexpr size_type | size_bytes () const noexcept |
| Returns the size of the sequence in bytes. | |
Public Constructors | |
| template<xtd::size count = 0> | |
| constexpr | span () |
| Creates an empty xtd::span whose xtd::span::data is null and xtd::span::size is 0. | |
| template<class iterator_t> | |
| constexpr | span (iterator_t first, iterator_t last) |
| Creates an xtd::span with specified iterators. | |
| template<xtd::size len> | |
| constexpr | span (element_type(&array)[len]) noexcept |
| Creates an xtd::span with specified native array. | |
| template<class array_type_t, xtd::size len> | |
| constexpr | span (const std::array< array_type_t, len > &array) noexcept |
| Creates an xtd::span with specified std::array. | |
| template<class array_type_t, xtd::size len> | |
| constexpr | span (std::array< array_type_t, len > &array) noexcept |
| Creates an xtd::span with specified std::array. | |
| template<class range_t> | |
| constexpr | span (range_t &&range) noexcept |
| Creates an xtd::span with specified range. | |
| constexpr | span (std::initializer_list< type_t > items) noexcept |
| Creates an xtd::span with specified initializer list. | |
| template<class collection_t> | |
| constexpr | span (collection_t &items, size_type length) |
| Creates an xtd::span with specified collection and count. | |
| template<class collection_t> | |
| constexpr | span (collection_t &items, size_type start, size_type length) |
| Creates an xtd::span with specified collection, offest and count. | |
| constexpr | span (type_t *const data, size_type length) |
| Creates an xtd::span with specified data pointer and count. | |
Public Methods | |
| const_reference | at (size_type pos) const |
| Gets the specified element with bounds checking. | |
| reference | at (size_type pos) |
| Gets the specified element with bounds checking. | |
| void | clear () noexcept |
| Clears the contents of this xtd::span <type> object. | |
| template<xtd::size length> | |
| void | copy_to (span< type_t, length > &destination) const |
| Copies the contents of this xtd::span <type_t> into a destination xtd:span <type_t>. | |
| bool | equals (const object &obj) const noexcept override |
| Determines whether the specified object is equal to the current object. | |
| bool | equals (const span &rhs) const noexcept override |
| Indicates whether the current object is equal to another object of the same type. | |
| void | fill (const type_t &value) |
| Fills the elements of this span with a specified value. | |
| template<xtd::size count> | |
| span< type_t, count > | first () const |
Obtains a subspan consisting of the first count elements of the sequence. | |
| span< type_t > | first (xtd::size count) const |
Obtains a subspan consisting of the first count elements of the sequence. | |
| xtd::size | get_hash_code () const noexcept override |
| Serves as a hash function for a particular type. | |
| template<xtd::size count> | |
| span< type_t, count > | last () const |
| Obtains a subspan consisting of the last N elements of the sequence. | |
| span< type_t > | last (xtd::size count) const |
| Obtains a subspan consisting of the last N elements of the sequence. | |
| template<xtd::size start, size_type lenght = xtd::dynamic_extent> | |
| span< type_t > | slice () const |
| Forms a slice out of the current span starting at a specified index for a specified length. | |
| span< type_t > | slice (size_type start) const |
| Forms a slice out of the current span that begins at a specified index. | |
| span< type_t > | slice (size_type start, size_type length) const |
| Forms a slice out of the current span starting at a specified index for a specified length. | |
| template<xtd::size offset, size_type count = xtd::dynamic_extent> | |
| span< type_t > | subspan () const |
| Forms a subspan of the current span starting at a specified index for a specified length. | |
| span< type_t > | subspan (size_type offset, size_type count=xtd::dynamic_extent) const |
| Forms a subspan of the current span starting at a specified index for a specified length. | |
| xtd::array< value_type > | to_array () const noexcept |
| Copies the contents of this span into a new array. | |
| string | to_string () const noexcept override |
| Returns the string representation of this xtd::span <type_t> object. | |
| template<xtd::size length> | |
| bool | try_copy_to (span< type_t, length > &destination) const noexcept |
| Attempts to copy the current xtd::span <type_t> to a destination xtd::span <type_t> and returns a value that indicates whether the copy operation succeeded. | |
Public Operators | |
| const_reference | operator[] (size_type index) const |
| Gets the element at the specified zero-based index. | |
| reference | operator[] (size_type index) |
| Gets the element at the specified zero-based index. | |
Additional Inherited Members | |
| object ()=default | |
| Create a new instance of the ultimate base class object. | |
| virtual type_object | get_type () const noexcept |
| Gets the type of the current instance. | |
| template<class object_t> | |
| xtd::unique_ptr_object< object_t > | memberwise_clone () const |
| Creates a shallow copy of the current object. | |
| virtual bool | equals (const type_t &) const noexcept=0 |
| Indicates whether the current object is equal to another object of the same type. | |
| template<class object_a_t, class object_b_t> | |
| static bool | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
| Determines whether the specified object instances are considered equal. | |
| template<class object_a_t, class object_b_t> | |
| static bool | reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
| Determines whether the specified object instances are the same instance. | |
| using xtd::span< type_t, extent >::element_type |
Represents the span elemeent type.
| using xtd::span< type_t, extent >::value_type |
Represents the span value type.
| using xtd::span< type_t, extent >::size_type |
Represents the span size type (usually xtd::size).
| using xtd::span< type_t, extent >::difference_type |
Represents the span difference type (usually xtd::ptrdiff).
| using xtd::span< type_t, extent >::pointer |
Represents the span pointer type.
| using xtd::span< type_t, extent >::const_pointer |
Represents the span const pointer type.
| using xtd::span< type_t, extent >::reference |
Represents the span reference type.
| using xtd::span< type_t, extent >::const_reference |
Represents the span const reference type.
| using xtd::span< type_t, extent >::iterator |
Represents the iterator of span value type.
| using xtd::span< type_t, extent >::const_iterator |
Represents the const iterator of span value type.
| using xtd::span< type_t, extent >::reverse_iterator |
Represents the reverse iterator of span value type.
| using xtd::span< type_t, extent >::const_reverse_iterator |
Represents the const reverse iterator of span value type.
|
inlineconstexpr |
Creates an empty xtd::span whose xtd::span::data is null and xtd::span::size is 0.
|
inlineconstexpr |
Creates an xtd::span with specified iterators.
| first | The iterator to the first element of the sequence. |
| last | The iterator to the last element of the sequence. |
|
inlineconstexprnoexcept |
Creates an xtd::span with specified native array.
| array | The native array to construct a view for. |
|
inlineconstexprnoexcept |
Creates an xtd::span with specified std::array.
| array | The std::array to construct a view for. |
|
inlineconstexprnoexcept |
Creates an xtd::span with specified std::array.
| array | The std::array to construct a view for. |
|
inlineconstexprnoexcept |
Creates an xtd::span with specified range.
| range | The range to construct a view for. |
|
inlineconstexprnoexcept |
Creates an xtd::span with specified initializer list.
| items | The initializer list to construct a view for. |
|
inlineconstexpr |
Creates an xtd::span with specified collection and count.
| items | The collection to construct a view for. |
| length | The number of elements in the collection. |
| xtd::argument_out_of_range_exception | if length is greater than items size. |
|
inlineconstexpr |
Creates an xtd::span with specified collection, offest and count.
| items | The collection to construct a view for. |
| start | The offset in the collection. |
| length | The number of elements in the collection. |
| xtd::argument_out_of_range_exception | if start or start + length are greater than items size. |
|
inlineconstexpr |
Creates an xtd::span with specified data pointer and count.
| data | The data pointer to construct a view for. |
| length | The number of elements to constuct. |
|
inline |
Gets the last element.
| argument_out_of_range_exception | if xtd::san i empty. |
|
inline |
Returns an iterator to the beginning.
|
inline |
Returns an iterator to the beginning.
|
inline |
Returns an iterator to the beginning.
|
inline |
Returns an iterator to the end.
|
inline |
Returns a reverse iterator to the beginning.
|
inline |
Returns a reverse iterator to the end.
|
inlineconstexprnoexcept |
Gets direct access to the underlying contiguous storage.
|
inlineconstexprnoexcept |
Returns a value that indicates whether the current xtd::span <type_t> is empty.
true if the current span is empty; otherwise, false.
|
inline |
Returns an iterator to the end.
|
inline |
Returns an iterator to the end.
|
inline |
Gets the first element.
| argument_out_of_range_exception | if xtd::san i empty. |
|
inlineconstexprnoexcept |
Returns a value that indicates whether the current xtd::span <type_t> is empty.
true if the current span is empty; otherwise, false.
|
inlineconstexprnoexcept |
Returns the length of the current span.
|
inline |
Returns a reverse iterator to the beginning.
|
inline |
Returns a reverse iterator to the beginning.
|
inline |
Returns a reverse iterator to the end.
|
inline |
Returns a reverse iterator to the end.
|
inlineconstexprnoexcept |
Returns the number of elements.
|
inlineconstexprnoexcept |
Returns the size of the sequence in bytes.
size() * sizeof(element_type).
|
inline |
Gets the specified element with bounds checking.
| pos | The position of the element to return. |
| xtd::index_out_of_range_exception | `index` is less than zero or greater than or equal to xtd::span::length. |
|
inline |
Gets the specified element with bounds checking.
| pos | The position of the element to return. |
| xtd::argument_out_of_range_exceptionv | if pos greather or equal than length. |
|
inlinenoexcept |
Clears the contents of this xtd::span <type> object.
|
inline |
Copies the contents of this xtd::span <type_t> into a destination xtd:span <type_t>.
| destinaton | The destination xtd::span <type_t> object. |
| xtd::argument_exception | `destination` is shorter than the source xtd::span <type_t>. |
|
inlineoverridevirtualnoexcept |
Determines whether the specified object is equal to the current object.
| obj | The object to compare with the current object. |
true if the specified object is equal to the current object. otherwise, false. Reimplemented from xtd::object.
|
inlineoverridenoexcept |
Indicates whether the current object is equal to another object of the same type.
| obj | An object to compare with this object. |
true if the current object is equal to the other parameter; otherwise, false.
|
inline |
Fills the elements of this span with a specified value.
| value | The value to assign to each element of the span. |
|
inline |
Obtains a subspan consisting of the first count elements of the sequence.
| count | The count elements. |
r that is a view over the first count elements of *this, such that r.data() == this->data() && r.size() == count.
|
inline |
Obtains a subspan consisting of the first count elements of the sequence.
| count | The count elements. |
r that is a view over the first count elements of *this, such that r.data() == this->data() && r.size() == count.
|
inlineoverridevirtualnoexcept |
Serves as a hash function for a particular type.
Reimplemented from xtd::object.
|
inline |
Forms a slice out of the current span starting at a specified index for a specified length.
| start | The zero-based index at which to begin this slice. |
| length | The desired length for the slice. |
| xtd::argument_out_of_range_exception | `start` or `start + length` is less than zero or greater than xtd::span::length. |
|
inline |
Forms a slice out of the current span that begins at a specified index.
| start | The zero-based index at which to begin the slice. |
start to the end of the span. | xtd::argument_out_of_range_exception | `start` is less than zero or greater than xtd::span::length. |
|
inline |
Forms a slice out of the current span starting at a specified index for a specified length.
| start | The zero-based index at which to begin this slice. |
| length | The desired length for the slice. |
| xtd::argument_out_of_range_exception | `start` or `start + length` is less than zero or greater than xtd::span::length. |
|
inline |
Forms a subspan of the current span starting at a specified index for a specified length.
| offset | The zero-based index at which to begin this slice. |
| count | The desired length for the slice. |
| xtd::argument_out_of_range_exception | `offset` or `offset + count` is less than zero or greater than xtd::span::length. |
|
inline |
Forms a subspan of the current span starting at a specified index for a specified length.
| offset | The zero-based index at which to begin this slice. |
| count | The desired length for the slice. |
| xtd::argument_out_of_range_exception | `offset` or `offset + count` is less than zero or greater than xtd::span::length. |
|
inlinenoexcept |
Copies the contents of this span into a new array.
|
inlineoverridevirtualnoexcept |
Returns the string representation of this xtd::span <type_t> object.
,. Reimplemented from xtd::object.
|
inlinenoexcept |
Attempts to copy the current xtd::span <type_t> to a destination xtd::span <type_t> and returns a value that indicates whether the copy operation succeeded.
| destination | The target of the copy operation. |
true if the copy operation succeeded; otherwise, false. source to destination even if source and destination overlap.
|
inline |
Gets the element at the specified zero-based index.
| index | The zero-based index of the element. |
| xtd::index_out_of_range_exception | `index` is less than zero or greater than or equal to xtd::span::length. |
|
inline |
Gets the element at the specified zero-based index.
| index | The zero-based index of the element. |
| xtd::index_out_of_range_exception | `index` is less than zero or greater than or equal to xtd::span::length. |