Represents a non-owning view over a contiguous sequence of objects.
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::usize). | |
| 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. | |
Public Fields | |
| static const span | empty_span |
| Returns an empty xtd::span <type_t> object. | |
Public Constructors | |
| template<xtd::usize count = 0> | |
| constexpr | span () |
| Creates an empty xtd::span whose xtd::span::data is null and xtd::span::size is 0. | |
| template<typename iterator_t> | |
| constexpr | span (iterator_t first, iterator_t last) |
| Creates an xtd::span with specified iterators. | |
| template<xtd::usize len> | |
| constexpr | span (element_type(&array)[len]) noexcept |
| Creates an xtd::span with specified native array. | |
| template<typename array_type_t, xtd::usize len> | |
| constexpr | span (const std::array< array_type_t, len > &array) noexcept |
| Creates an xtd::span with specified std::array. | |
| template<typename array_type_t, xtd::usize len> | |
| constexpr | span (std::array< array_type_t, len > &array) noexcept |
| Creates an xtd::span with specified std::array. | |
| template<typename array_type_t> | |
| constexpr | span (const xtd::array< array_type_t > &items) |
| Creates an xtd::span with specified collection and count. | |
| template<typename array_type_t> | |
| constexpr | span (xtd::array< array_type_t > &items) |
| Creates an xtd::span with specified collection and count. | |
| template<typename 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<typename collection_t> | |
| constexpr | span (collection_t &items, size_type length) |
| Creates an xtd::span with specified collection and count. | |
| template<typename 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. | |
| template<typename collection_t> | |
| constexpr | span (collection_t &items, const xtd::range &range) |
| Creates an xtd::span with specified collection, and range. | |
Public Properties | |
| constexpr auto | data () const noexcept -> const_pointer |
| Gets direct access to the underlying contiguous storage. | |
| constexpr auto | data () noexcept -> pointer |
| Gets direct access to the underlying contiguous storage. | |
| constexpr auto | empty () const noexcept -> bool |
| Returns a value that indicates whether the current xtd::span <type_t> is empty. | |
| constexpr auto | is_empty () const noexcept -> bool |
| Returns a value that indicates whether the current xtd::span <type_t> is empty. | |
| constexpr auto | length () const noexcept -> size_type |
| Returns the length of the current span. | |
| constexpr auto | size () const noexcept -> size_type |
| Returns the number of elements. | |
| constexpr auto | size_bytes () const noexcept -> size_type |
| Returns the size of the sequence in bytes. | |
Public Methods | |
| auto | clear () noexcept -> void |
| Clears the contents of this xtd::span <type> object. | |
| template<xtd::usize length> | |
| auto | copy_to (span< type_t, length > &destination) const -> void |
| Copies the contents of this xtd::span <type_t> into a destination xtd:span <type_t>. | |
| auto | equals (const object &obj) const noexcept -> bool override |
| Determines whether the specified object is equal to the current object. | |
| auto | equals (const span &rhs) const noexcept -> bool override |
| Indicates whether the current object is equal to another object of the same type. | |
| auto | fill (const type_t &value) -> void |
| Fills the elements of this span with a specified value. | |
| template<xtd::usize count> | |
| auto | first () const -> span< type_t, count > |
| Obtains a subspan consisting of the first count elements of the sequence. | |
| auto | first (xtd::usize count) const -> span< type_t > |
| Obtains a subspan consisting of the first count elements of the sequence. | |
| auto | get_enumerator () const -> xtd::collections::generic::enumerator< type_t > override |
| Returns an enumerator that iterates through a collection. | |
| auto | get_hash_code () const noexcept -> xtd::usize override |
| Serves as a hash function for a particular type. | |
| template<xtd::usize count> | |
| auto | last () const -> span< type_t, count > |
| Obtains a subspan consisting of the last N elements of the sequence. | |
| auto | last (xtd::usize count) const -> span< type_t > |
| Obtains a subspan consisting of the last N elements of the sequence. | |
| template<xtd::usize start, size_type lenght = xtd::dynamic_extent> | |
| auto | slice () const -> span< type_t > |
| Forms a slice out of the current span starting at a specified index for a specified length. | |
| auto | slice (size_type start) const -> span< type_t > |
| Forms a slice out of the current span that begins at a specified index. | |
| auto | slice (size_type start, size_type length) const -> span< type_t > |
| Forms a slice out of the current span starting at a specified index for a specified length. | |
| template<xtd::usize offset, size_type count = xtd::dynamic_extent> | |
| auto | subspan () const -> span< type_t > |
| Forms a subspan of the current span starting at a specified index for a specified length. | |
| auto | subspan (size_type offset, size_type count=xtd::dynamic_extent) const -> span< type_t > |
| Forms a subspan of the current span starting at a specified index for a specified length. | |
| auto | to_array () const noexcept -> xtd::array< value_type > |
| Copies the contents of this span into a new array. | |
| auto | to_string () const noexcept -> xtd::string override |
| Returns the string representation of this xtd::span <type_t> object. | |
| template<xtd::usize length> | |
| auto | try_copy_to (span< type_t, length > &destination) const noexcept -> bool |
| 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 | |
| auto | operator[] (size_type index) const -> const_reference |
| Gets the element at the specified zero-based index. | |
| auto | operator[] (size_type index) -> reference |
| Gets the element at the specified zero-based index. | |
| auto | operator[] (const xtd::index &index) const -> const_reference |
| Gets the element at the specified zero-based index. | |
| auto | operator[] (const xtd::index &index) -> reference |
| Gets the element at the specified zero-based index. | |
| auto | operator[] (const xtd::range &range) const -> xtd::read_only_span< type_t > |
| Gets the elements at the specified range. | |
| auto | operator[] (const xtd::range &range) -> span |
| Gets the elements at the specified range. | |
| auto | operator() (size_type index) const -> const_reference |
| Gets the element at the specified zero-based index. | |
| auto | operator() (size_type index) -> reference |
| Gets the element at the specified zero-based index. | |
| auto | operator() (const xtd::index &index) const -> const_reference |
| Gets the element at the specified zero-based index. | |
| auto | operator() (const xtd::index &index) -> reference |
| Gets the element at the specified zero-based index. | |
| auto | operator() (const xtd::range &range) const -> xtd::read_only_span< type_t > |
| Gets the elements at the specified range. | |
| auto | operator() (const xtd::range &range) -> span |
| Gets the elements at the specified range. | |
Additional Inherited Members | |
| using | value_type |
| Represents the xtd::collections::generic::ienumerable value type. | |
| using | iterator |
| Represents the iterator of xtd::collections::generic::ienumerable value type. | |
| using | const_iterator |
| Represents the const iterator of xtd::collections::generic::ienumerable value type. | |
| using | iterator |
| Represents the iterator of enumerable value type. | |
| using | const_iterator |
| Represents the const iterator of enumerable value type. | |
| using | enumerable_type |
| Represents the ienumerable enumerable type. | |
| using | value_type |
| Represents the ienumerable value type. | |
| using | ienumerable |
| Represents the ienumerable value type. | |
| using | list |
| Represents the list value type. | |
| object ()=default | |
| Create a new instance of the ultimate base class object. | |
| virtual auto | get_type () const noexcept -> type_object |
| Gets the type of the current instance. | |
| template<typename object_t> | |
| auto | memberwise_clone () const -> xtd::unique_ptr_object< object_t > |
| Creates a shallow copy of the current object. | |
| virtual auto | equals (const type_t &) const noexcept -> bool=0 |
| Indicates whether the current object is equal to another object of the same type. | |
| auto | begin () const -> const_iterator |
| Returns an iterator to the first element of the enumerable. | |
| auto | cbegin () const -> const_iterator |
| Returns an iterator to the first element of the enumerable. | |
| auto | cend () const -> const_iterator |
| Returns an iterator to the element following the last element of the enumerable. | |
| auto | end () const -> const_iterator |
| Returns an iterator to the element following the last element of the enumerable. | |
| auto | aggregate (auto &&funcfunc) const -> type_t |
| Applies an accumulator function over a sequence. | |
| auto | all (predicate_t &&predicatepredicate) const -> bool |
| Determines whether all elements of a sequence satisfy a condition. | |
| auto | any () const noexcept -> bool |
| Determines whether a sequence contains any elements. | |
| auto | append (element_t &&element) const noexcept -> xtd::collections::generic::enumerable_generator< type_t > |
| Appends a value to the end of the sequence. | |
| auto | as_enumerable () const noexcept |
| Returns the input typed as xtd::collections::generic::ienumerable <type_t>. | |
| auto | average () const noexcept |
| Computes the average of a sequence of value_t values. | |
| auto | cast () const noexcept -> xtd::collections::generic::enumerable_generator< result_t > |
| Casts the elements of an xtd::collections::generic::ienumerable to the specified type. | |
| auto | chunk (xtd::usize size) const -> xtd::collections::generic::enumerable_generator< xtd::array< type_t > > |
| Splits the elements of a sequence into chunks of size at most size. | |
| auto | concat (second_t &&second) const noexcept -> xtd::collections::generic::enumerable_generator< type_t > |
| Concatenates two sequences. | |
| auto | contains (type_t &&value) const noexcept -> bool |
| Determines whether a sequence contains a specified element by using the default equality comparer. | |
| auto | count () const noexcept -> xtd::usize |
| Returns the number of elements in current sequence. | |
| auto | count_by (key_selector_t &&key_selector) const noexcept |
| Returns the count of elements in the current sequence grouped by key. | |
| auto | default_if_empty () const noexcept -> xtd::collections::generic::enumerable_generator< type_t > |
| Returns the elements of the specified sequence or the type parameter's default value in a singleton collection if the current sequence is empty. | |
| auto | distinct () const noexcept -> xtd::collections::generic::enumerable_generator< type_t > |
| Returns distinct elements from a sequence by using the default equality comparer to compare values. | |
| auto | first () const -> type_t |
| Returns the first element of a sequence. | |
| auto | first_or_default (predicate_t &&predicatepredicate, type_t &&default_value) const noexcept -> type_t |
| Returns the first element of the sequence that satisfies a condition, or a specified default value if no such element is found. | |
| auto | last () const -> type_t |
| Returns the last element of a sequence. | |
| auto | max () const -> type_t |
| Returns the maximum value in a sequence of xtd::numeric values. | |
| auto | min () const -> type_t |
| Returns the minimum value in a sequence of xtd::numeric values. | |
| auto | order () const -> xtd::collections::generic::enumerable_generator< type_t > |
| Sorts the elements of a sequence in ascending order. | |
| auto | order_by (const std::function< type_t(const type_t &)> &key_selector) const |
| Sorts the elements of a sequence in ascending order according to a key. | |
| auto | order_by_descending (const std::function< key_t(const type_t &)> &key_selector) const |
| Sorts the elements of a sequence in descending order according to a key. | |
| auto | reverse () const -> xtd::collections::generic::enumerable_generator< type_t > |
| Inverts the order of the elements in a sequence. | |
| auto | select (auto &&selector) const |
| Projects each element of a sequence into a new form. | |
| auto | sequence_equal (second_t &&second) const -> bool |
| Determines whether two sequences are equal by comparing the elements by using the default equality comparer for their type. | |
| auto | shuffle () const -> xtd::collections::generic::enumerable_generator< type_t > |
| Shuffles the order of the elements of a sequence. | |
| auto | skip (xtd::usize count) const -> xtd::collections::generic::enumerable_generator< type_t > |
| Bypasses a specified number of elements in a sequence and then returns the remaining elements. | |
| auto | skip_while (auto &&predicatepredicate) const -> xtd::collections::generic::enumerable_generator< type_t > |
| Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements. | |
| auto | take (xtd::usize count) const -> xtd::collections::generic::enumerable_generator< type_t > |
| Returns a specified number of contiguous elements from the start of a sequence. | |
| auto | take_while (auto &&predicatepredicate) const -> xtd::collections::generic::enumerable_generator< type_t > |
| Returns elements from a sequence as long as a specified condition is true, and then skips the remaining elements. | |
| auto | to_array () const -> xtd::array< type_t > |
| Creates a xtd::array <type_t> from an xtd::collections::generic::ienumerable <type_t>. | |
| auto | to_list () const -> xtd::collections::generic::list< type_t > |
| Creates a xtd::collections::generic::list <type_t> from an xtd::collections::generic::ienumerable <type_t>. | |
| auto | where (auto &&predicatepredicate) const |
| Filters a sequence of values based on a predicate. | |
| auto | zip (second_t &&second) const -> xtd::collections::generic::enumerable_generator< std::tuple< type_t, xtd::iterable_value_type< second_t > > > |
| Produces a sequence of tuples with elements from the two specified sequences. | |
| template<typename object_a_t, typename object_b_t> | |
| static auto | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool |
| Determines whether the specified object instances are considered equal. | |
| template<typename object_a_t, typename object_b_t> | |
| static auto | reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool |
| Determines whether the specified object instances are the same instance. | |
| static auto | to_const_iterator (typename source_collection_t::const_iterator &value, const source_collection_t &source_collection, const target_collection_t &target_collection) noexcept -> typename target_collection_t::const_iterator |
| Converts source iterator to target iterator. | |
| static auto | to_iterator (typename source_collection_t::const_iterator &value, const source_collection_t &source_collection, const target_collection_t &target_collection) noexcept -> typename target_collection_t::const_iterator |
| Converts source iterator to target iterator. | |
| 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::usize).
| 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.
|
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. |
|
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 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. |
|
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. |
|
inlineconstexpr |
Creates an xtd::span with specified collection, and range.
| items | The collection to construct a view for. |
| range | The range of elements in the collection. |
| xtd::argument_out_of_range_exception | if range.start or range.start + range.end - range.start are greater than items size. |
|
inlinenodiscardconstexprnoexcept |
Gets direct access to the underlying contiguous storage.
|
inlinenodiscardconstexprnoexcept |
Gets direct access to the underlying contiguous storage.
|
inlinenodiscardconstexprnoexcept |
Returns a value that indicates whether the current xtd::span <type_t> is empty.
|
inlinenodiscardconstexprnoexcept |
Returns a value that indicates whether the current xtd::span <type_t> is empty.
|
inlinenodiscardconstexprnoexcept |
Returns the length of the current span.
|
inlinenodiscardconstexprnoexcept |
Returns the number of elements.
|
inlinenodiscardconstexprnoexcept |
Returns the size of the sequence in bytes.
|
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>. |
|
inlinenodiscardoverridevirtualnoexcept |
Determines whether the specified object is equal to the current object.
| obj | The object to compare with the current object. |
Reimplemented from xtd::object.
|
inlinenodiscardoverridenoexcept |
Indicates whether the current object is equal to another object of the same type.
| obj | An object to compare with this object. |
|
inline |
Fills the elements of this span with a specified value.
| value | The value to assign to each element of the span. |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlineoverridevirtual |
Returns an enumerator that iterates through a collection.
Implements xtd::collections::generic::ienumerable< type_t >.
|
inlinenodiscardoverridevirtualnoexcept |
Serves as a hash function for a particular type.
Reimplemented from xtd::object.
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
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. |
|
inlinenodiscard |
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. |
| xtd::argument_out_of_range_exception | start is less than zero or greater than xtd::span::length. |
|
inlinenodiscard |
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. |
|
inlinenodiscard |
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. |
|
inlinenodiscard |
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. |
|
inlinenodiscardnoexcept |
Copies the contents of this span into a new array.
|
inlinenodiscardoverridevirtualnoexcept |
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. |
|
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. |
|
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. |
| auto xtd::span< type_t, extent >::operator[] | ( | const xtd::range & | range | ) | const -> xtd::read_only_span< type_t > |
Gets the elements at the specified range.
| range | The range of the elements to set. |
|
inline |
Gets the elements at the specified range.
| range | The range of the elements to set. |
|
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. |
|
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. |
| auto xtd::span< type_t, extent >::operator() | ( | const xtd::range & | range | ) | const -> xtd::read_only_span< type_t > |
Gets the elements at the specified range.
| range | The range of the elements to set. |
|
inline |
Gets the elements at the specified range.
| range | The range of the elements to set. |
|
static |