5#define __XTD_STD_INTERNAL__
7#undef __XTD_STD_INTERNAL__
51 template<
class type_t, xtd::size extent = dynamic_extent>
78 using reverse_iterator =
const std::reverse_iterator<xtd::collections::generic::helpers::wrap_pointer_iterator<pointer>>;
80 using const_reverse_iterator =
const std::reverse_iterator<xtd::collections::generic::helpers::wrap_pointer_iterator<pointer>>;
87 template <xtd::size count = 0>
94 template<
class iterator_t>
103#if defined(__xtd__cpp_lib_type_identity)
106 template<xtd::size len>
111 template<xtd::size len>
116 template<
class array_type_t, xtd::size len>
118#if defined(__xtd__cpp_lib_ranges)
121 template<
class range_t>
122 constexpr read_only_span(range_t&& range) noexcept : data_ {xtd::ranges::data(range)}, length_ {extent !=
dynamic_extent ? extent : xtd::ranges::size(range)} {}
126 template<
class range_t>
131 constexpr read_only_span(std::initializer_list<type_t> items) noexcept : data_ {items.begin()}, length_ {extent !=
dynamic_extent ? extent : items.size()} {}
143 template<
class collection_t>
150 template<
class collection_t>
178 return *(data_ + length_ - 1);
225 constexpr bool is_empty() const noexcept {
return !length_;}
257 return *(data_ + pos);
263 template<xtd::size length>
281 template<xtd::size count>
298 for (
const auto& item : *
this)
306 template<xtd::size count>
324 template<xtd::size start,
size_type lenght = xtd::dynamic_extent>
334 return slice(start, length_ - start);
352 template<xtd::size offset,
size_type count = xtd::dynamic_extent>
384 template<xtd::size length>
386 if (destination.length() < this->length())
return false;
387 for (
auto index =
xtd::size {}; index < length_; ++index)
388 destination.at(index) =
at(index);
408 template<
class type_t, xtd::size extent>
414 template<
class iterator_t>
415 read_only_span(iterator_t first, iterator_t last) -> read_only_span<typename iterator_t::value_type>;
417 template<
class type_t, xtd::size len>
418 read_only_span(
const type_t (&array)[len]) -> read_only_span<type_t>;
420 template<
class type_t, xtd::size len>
421 read_only_span(
const std::array<type_t, len>& array) -> read_only_span<type_t>;
423#if defined(__xtd__cpp_lib_ranges)
424 template<
class range_t>
425 read_only_span(range_t&& items) -> read_only_span<typename std::remove_reference_t<xtd::ranges::range_reference_t<range_t>>>;
427 template<
class range_t>
428 read_only_span(range_t&& items) -> read_only_span<typename range_t::value_type>;
431 template<
class collection_t>
432 read_only_span(
const collection_t& items) -> read_only_span<typename collection_t::value_type>;
434 template<
class collection_t>
435 read_only_span(
const collection_t& items,
xtd::size) -> read_only_span<typename collection_t::value_type>;
437 template<
class collection_t>
438 read_only_span(
const collection_t& items,
xtd::size,
xtd::size) -> read_only_span<typename collection_t::value_type>;
440 template<
class type_t>
441 read_only_span(
const type_t* data,
xtd::size size) -> read_only_span<type_t>;
Contains __xtd_std_version definitions.
Contains xtd::argument_null_exception exception.
Contains xtd::argument_out_of_range_exception exception.
Contains xtd::array class.
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:59
virtual pointer data() noexcept
Returns pointer to the underlying array serving as element storage.
Definition basic_array.hpp:149
static basic_string join(const basic_string separator, const collection_t &values) noexcept
Concatenates a specified separator basic_string between each element of a specified object array,...
Definition basic_string.hpp:2288
Represents a wrap pointer iterator.
Definition wrap_pointer_iterator.hpp:35
Combines the hash code for multiple values into a single hash code.
Definition hash_code.hpp:26
xtd::size to_hash_code() const noexcept
Calculates the final hash code after consecutive xtd::hash_code::add invocations.
hash_code & add(const type_t value) noexcept
Adds a single value to the hash code.
Definition hash_code.hpp:43
static void throws(xtd::helpers::exception_case exception_case, const source_location &location=source_location::current())
Throws an exption with specified exception case.
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:22
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:44
Represents a non-owning view over a contiguous sequence of objects.
Definition read_only_span.hpp:52
static const read_only_span empty_read_only_span
Returns an empty xtd::read_only_span <type_t> object.
Definition read_only_span.hpp:209
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.
Definition read_only_span.hpp:333
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.
Definition read_only_span.hpp:342
const_reverse_iterator crbegin() const
Returns a reverse iterator to the beginning.
Definition read_only_span.hpp:194
const_iterator cbegin() const
Returns an iterator to the beginning.
Definition read_only_span.hpp:187
string to_string() const noexcept override
Returns the string representation of this xtd::read_only_span <type_t> object.
Definition read_only_span.hpp:375
xtd::array< std::remove_cv_t< type_t > > to_array() const noexcept
Copies the contents of this read_only_span into a new array.
Definition read_only_span.hpp:368
constexpr read_only_span()
Creates an empty xtd::read_only_span whose xtd::read_only_span::data is null and xtd::read_only_span:...
Definition read_only_span.hpp:88
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>.
Definition read_only_span.hpp:264
const type_t & const_reference
Represents the read_only_span const reference type.
Definition read_only_span.hpp:72
constexpr size_type size() const noexcept
Returns the number of elements.
Definition read_only_span.hpp:241
const std::reverse_iterator< xtd::collections::generic::helpers::wrap_pointer_iterator< pointer > > const_reverse_iterator
Represents the const reverse iterator of read_only_span value type.
Definition read_only_span.hpp:80
constexpr read_only_span(const collection_t &items, size_type length)
Creates an xtd::read_only_span with specified collection and count.
Definition read_only_span.hpp:144
std::add_cv_t< type_t > element_type
Represents the read_only_span elemeent type.
Definition read_only_span.hpp:58
const_reference back() const
Gets the last element.
Definition read_only_span.hpp:176
xtd::size size_type
Represents the read_only_span size type (usually xtd::size).
Definition read_only_span.hpp:62
const_reference front() const
Gets the first element.
Definition read_only_span.hpp:218
constexpr read_only_span(const element_type(&array)[len]) noexcept
Creates an xtd::read_only_span with specified native array.
Definition read_only_span.hpp:112
const_reference at(size_type pos) const
Gets the specified element with bounds checking.
Definition read_only_span.hpp:255
constexpr read_only_span(const std::array< array_type_t, len > &array) noexcept
Creates an xtd::read_only_span with specified std::array.
Definition read_only_span.hpp:117
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.
Definition read_only_span.hpp:325
constexpr read_only_span(range_t &&range) noexcept
Creates an xtd::read_only_span with specified range.
Definition read_only_span.hpp:127
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_...
Definition read_only_span.hpp:385
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.
Definition read_only_span.hpp:362
constexpr const_pointer data() const noexcept
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:201
const_iterator cend() const
Returns an iterator to the end.
Definition read_only_span.hpp:190
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.
Definition read_only_span.hpp:151
constexpr bool empty() const noexcept
Returns a value that indicates whether the current xtd::read_only_span <type_t> is empty.
Definition read_only_span.hpp:205
read_only_span< type_t, count > first() const
Obtains a subspan consisting of the first count elements of the sequence.
Definition read_only_span.hpp:282
std::add_cv_t< type_t > value_type
Represents the read_only_span value type.
Definition read_only_span.hpp:60
bool equals(const object &obj) const noexcept override
Determines whether the specified object is equal to the current object.
Definition read_only_span.hpp:272
const_iterator begin() const
Returns an iterator to the beginning.
Definition read_only_span.hpp:183
constexpr read_only_span(const type_t *data, size_type length)
Creates an xtd::read_only_span with specified data pointer and count.
Definition read_only_span.hpp:157
read_only_span< type_t > last(xtd::size count) const
Obtains a subspan consisting of the last N elements of the sequence.
Definition read_only_span.hpp:314
read_only_span< type_t, count > last() const
Obtains a subspan consisting of the last N elements of the sequence.
Definition read_only_span.hpp:307
constexpr read_only_span(iterator_t first, iterator_t last)
Creates an xtd::read_only_span with specified iterators.
Definition read_only_span.hpp:95
const_reference operator[](size_type index) const
Gets the element at the specified zero-based index.
Definition read_only_span.hpp:400
constexpr bool is_empty() const noexcept
Returns a value that indicates whether the current xtd::read_only_span <type_t> is empty.
Definition read_only_span.hpp:225
const_reverse_iterator rend() const
Returns a reverse iterator to the end.
Definition read_only_span.hpp:237
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.
Definition read_only_span.hpp:353
const std::reverse_iterator< xtd::collections::generic::helpers::wrap_pointer_iterator< pointer > > reverse_iterator
Represents the reverse iterator of read_only_span value type.
Definition read_only_span.hpp:78
const type_t & reference
Represents the read_only_span reference type.
Definition read_only_span.hpp:70
constexpr read_only_span(std::initializer_list< type_t > items) noexcept
Creates an xtd::read_only_span with specified initializer list.
Definition read_only_span.hpp:131
xtd::ptrdiff difference_type
Represents the read_only_span difference type (usually xtd::ptrdiff).
Definition read_only_span.hpp:64
bool equals(const read_only_span &rhs) const noexcept override
Indicates whether the current object is equal to another object of the same type.
Definition read_only_span.hpp:276
const type_t * pointer
Represents the read_only_span pointer type.
Definition read_only_span.hpp:66
const_iterator end() const
Returns an iterator to the end.
Definition read_only_span.hpp:213
constexpr size_type length() const noexcept
Returns the length of the current read_only_span.
Definition read_only_span.hpp:229
const_reverse_iterator rbegin() const
Returns a reverse iterator to the beginning.
Definition read_only_span.hpp:233
xtd::size get_hash_code() const noexcept override
Serves as a hash function for a particular type.
Definition read_only_span.hpp:296
read_only_span< type_t > first(xtd::size count) const
Obtains a subspan consisting of the first count elements of the sequence.
Definition read_only_span.hpp:289
constexpr size_type size_bytes() const noexcept
Returns the size of the sequence in bytes.
Definition read_only_span.hpp:245
const_reverse_iterator crend() const
Returns a reverse iterator to the end.
Definition read_only_span.hpp:197
const type_t * const_pointer
Represents the read_only_span const pointer type.
Definition read_only_span.hpp:68
Represents a non-owning view over a contiguous sequence of objects.
Definition span.hpp:58
Contains xtd::dynamic_extent field.
@ argument
The argument is not valid.
@ index_out_of_range
The index is out of range.
@ argument_null
The argument is null.
@ argument_out_of_range
The argument is out of range.
constexpr xtd::size dynamic_extent
Represents the constant of type xtd::size signifying that the span has dynamic extent.
Definition dynamic_extent.hpp:24
null_ptr null
Represents a null pointer value.
size_t size
Represents a size of any object in bytes.
Definition size.hpp:23
std::ptrdiff_t ptrdiff
Represent the signed integer type of the result of subtracting two pointers.
Definition ptrdiff.hpp:23
Contains xtd::iequatable interface.
Contains xtd::index_out_of_range_exception exception.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
Contains xtd::null pointer valiue.
Contains xtd::object class.
Contains xtd::ptrdiff type.
Contains xtd::ranges and xtd::views namespaces.
Contains xtd::span class.
Contains typeof_ keyword.
Contains xtd::collections::generic::helpers::wrap_pointer_iterator class.