Represents a non-owning view over a contiguous sequence of objects.
Public Aliases | |
using | element_type = std::add_cv_t< type_t > |
Represents the read_only_span elemeent type. | |
using | value_type = std::add_cv_t< type_t > |
Represents the read_only_span value type. | |
using | size_type = xtd::size |
Represents the read_only_span size type (usually xtd::size). | |
using | difference_type = xtd::ptrdiff |
Represents the read_only_span difference type (usually xtd::ptrdiff). | |
using | pointer = const type_t * |
Represents the read_only_span pointer type. | |
using | const_pointer = const type_t * |
Represents the read_only_span const pointer type. | |
using | reference = const type_t & |
Represents the read_only_span reference type. | |
using | const_reference = const type_t & |
Represents the read_only_span const reference type. | |
using | iterator = const xtd::collections::generic::helpers::wrap_pointer_iterator< pointer > |
Represents the iterator of read_only_span value type. | |
using | const_iterator = const xtd::collections::generic::helpers::wrap_pointer_iterator< pointer > |
Represents the const iterator of read_only_span value type. | |
using | reverse_iterator = const std::reverse_iterator< xtd::collections::generic::helpers::wrap_pointer_iterator< pointer > > |
Represents the reverse iterator of read_only_span value type. | |
using | const_reverse_iterator = const std::reverse_iterator< xtd::collections::generic::helpers::wrap_pointer_iterator< pointer > > |
Represents the const reverse iterator of read_only_span value type. | |
Public Properties | |
static const read_only_span | empty_read_only_span |
Returns an empty xtd::read_only_span <type_t> object. | |
const_reference | back () const |
Gets the last element. | |
const_iterator | begin () const |
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::read_only_span <type_t> is empty. | |
const_iterator | end () const |
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::read_only_span <type_t> is empty. | |
constexpr size_type | length () const noexcept |
Returns the length of the current read_only_span. | |
const_reverse_iterator | rbegin () const |
Returns a reverse iterator to the beginning. | |
const_reverse_iterator | rend () const |
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 | read_only_span () |
Creates an empty xtd::read_only_span whose xtd::read_only_span::data is null and xtd::read_only_span::size is 0. | |
template<class iterator_t > | |
constexpr | read_only_span (iterator_t first, iterator_t last) |
Creates an xtd::read_only_span with specified iterators. | |
template<xtd::size len> | |
constexpr | read_only_span (const element_type(&array)[len]) noexcept |
Creates an xtd::read_only_span with specified native array. | |
template<class array_type_t , xtd::size len> | |
constexpr | read_only_span (const std::array< array_type_t, len > &array) noexcept |
Creates an xtd::read_only_span with specified std::array. | |
template<class range_t > | |
constexpr | read_only_span (range_t &&range) noexcept |
Creates an xtd::read_only_span with specified range. | |
constexpr | read_only_span (std::initializer_list< type_t > items) noexcept |
Creates an xtd::read_only_span with specified initializer list. | |
template<class collection_t > | |
constexpr | read_only_span (const collection_t &items, size_type length) |
Creates an xtd::read_only_span with specified collection and count. | |
template<class collection_t > | |
constexpr | read_only_span (const collection_t &items, size_type start, size_type length) |
Creates an xtd::read_only_span with specified collection, offest and count. | |
constexpr | read_only_span (const type_t *data, size_type length) |
Creates an xtd::read_only_span with specified data pointer and count. | |
Public Methods | |
const_reference | at (size_type pos) const |
Gets the specified element with bounds checking. | |
template<xtd::size length> | |
void | copy_to (span< type_t, length > &destination) const |
Copies the contents of this xtd::read_only_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 read_only_span &rhs) const noexcept override |
Indicates whether the current object is equal to another object of the same type. | |
template<xtd::size count> | |
read_only_span< type_t, count > | first () const |
Obtains a subspan consisting of the first count elements of the sequence. | |
read_only_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> | |
read_only_span< type_t, count > | last () const |
Obtains a subspan consisting of the last N elements of the sequence. | |
read_only_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> | |
read_only_span< type_t > | slice () const |
Forms a slice out of the current read_only_span starting at a specified index for a specified length. | |
read_only_span< type_t > | slice (size_type start) const |
Forms a slice out of the current read_only_span that begins at a specified index. | |
read_only_span< type_t > | slice (size_type start, size_type length) const |
Forms a slice out of the current read_only_span starting at a specified index for a specified length. | |
template<xtd::size offset, size_type count = xtd::dynamic_extent> | |
read_only_span< type_t > | subspan () const |
Forms a subspan of the current read_only_span starting at a specified index for a specified length. | |
read_only_span< type_t > | subspan (size_type offset, size_type count=xtd::dynamic_extent) const |
Forms a subspan of the current read_only_span starting at a specified index for a specified length. | |
xtd::array< std::remove_cv_t< type_t > > | to_array () const noexcept |
Copies the contents of this read_only_span into a new array. | |
string | to_string () const noexcept override |
Returns the string representation of this xtd::read_only_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::read_only_span <type_t> to a destination xtd::read_only_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. | |
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::uptr< 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::read_only_span< type_t, extent >::element_type = std::add_cv_t<type_t> |
Represents the read_only_span elemeent type.
using xtd::read_only_span< type_t, extent >::value_type = std::add_cv_t<type_t> |
Represents the read_only_span value type.
using xtd::read_only_span< type_t, extent >::size_type = xtd::size |
Represents the read_only_span size type (usually xtd::size).
using xtd::read_only_span< type_t, extent >::difference_type = xtd::ptrdiff |
Represents the read_only_span difference type (usually xtd::ptrdiff).
using xtd::read_only_span< type_t, extent >::pointer = const type_t* |
Represents the read_only_span pointer type.
using xtd::read_only_span< type_t, extent >::const_pointer = const type_t* |
Represents the read_only_span const pointer type.
using xtd::read_only_span< type_t, extent >::reference = const type_t& |
Represents the read_only_span reference type.
using xtd::read_only_span< type_t, extent >::const_reference = const type_t& |
Represents the read_only_span const reference type.
using xtd::read_only_span< type_t, extent >::iterator = const xtd::collections::generic::helpers::wrap_pointer_iterator<pointer> |
Represents the iterator of read_only_span value type.
using xtd::read_only_span< type_t, extent >::const_iterator = const xtd::collections::generic::helpers::wrap_pointer_iterator<pointer> |
Represents the const iterator of read_only_span value type.
using xtd::read_only_span< type_t, extent >::reverse_iterator = const std::reverse_iterator<xtd::collections::generic::helpers::wrap_pointer_iterator<pointer> > |
Represents the reverse iterator of read_only_span value type.
using xtd::read_only_span< type_t, extent >::const_reverse_iterator = const std::reverse_iterator<xtd::collections::generic::helpers::wrap_pointer_iterator<pointer> > |
Represents the const reverse iterator of read_only_span value type.
|
inlineconstexpr |
Creates an empty xtd::read_only_span whose xtd::read_only_span::data is null and xtd::read_only_span::size is 0.
|
inlineconstexpr |
Creates an xtd::read_only_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::read_only_span with specified native array.
array | The native array to construct a view for. |
|
inlineconstexprnoexcept |
Creates an xtd::read_only_span with specified std::array.
array | The std::array to construct a view for. |
|
inlineconstexprnoexcept |
Creates an xtd::read_only_span with specified range.
range | The range to construct a view for. |
|
inlineconstexprnoexcept |
Creates an xtd::read_only_span with specified initializer list.
items | The initializer list to construct a view for. |
|
inlineconstexpr |
Creates an xtd::read_only_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::read_only_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 offset or offset + length are greater than items size. |
|
inlineconstexpr |
Creates an xtd::read_only_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 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::read_only_span <type_t> is empty.
true
if the current read_only_span is empty; otherwise, false
.
|
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::read_only_span <type_t> is empty.
true
if the current read_only_span is empty; otherwise, false
.
|
inlineconstexprnoexcept |
Returns the length of the current read_only_span.
|
inline |
Returns a reverse iterator to the beginning.
|
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::read_only_span::length. |
|
inline |
Copies the contents of this xtd::read_only_span <type_t> into a destination xtd:span <type_t>.
destinaton | The destination xtd::read_only_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 |
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 |
Obtains a subspan consisting of the last N elements of the sequence.
count | The count elements. |
r
that is a view over the last count
elements of *this
, such that r.data() == this->data() + (this->size() - count) && r.size() == count
.
|
inline |
Obtains a subspan consisting of the last N elements of the sequence.
count | The count elements. |
r
that is a view over the last count
elements of *this
, such that r.data() == this->data() + (this->size() - count) && r.size() == count
.
|
inline |
Forms a slice out of the current read_only_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::read_only_span::length. |
|
inline |
Forms a slice out of the current read_only_span that begins at a specified index.
start | The zero-based index at which to begin the slice. |
start
to the end of the read_only_span. xtd::argument_out_of_range_exception | `start` is less than zero or greater than xtd::read_only_span::length. |
|
inline |
Forms a slice out of the current read_only_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::read_only_span::length. |
|
inline |
Forms a subspan of the current read_only_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::read_only_span::length. |
|
inline |
Forms a subspan of the current read_only_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::read_only_span::length. |
|
inlinenoexcept |
Copies the contents of this read_only_span into a new array.
|
inlineoverridevirtualnoexcept |
Returns the string representation of this xtd::read_only_span <type_t> object.
,
. Reimplemented from xtd::object.
|
inlinenoexcept |
Attempts to copy the current xtd::read_only_span <type_t> to a destination xtd::read_only_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::read_only_span::length. |
|
inlinestatic |
Returns an empty xtd::read_only_span <type_t> object.