50 constexpr index() noexcept = default;
71 [[nodiscard]]
constexpr auto is_from_end() const noexcept ->
bool {
return __v__ > std::numeric_limits<value_type>::max() / 2;}
80 [[nodiscard]]
auto equals(
const object& obj)
const noexcept ->
bool override;
97 [[nodiscard]] auto
to_string() const noexcept ->
xtd::
string override;
105 auto operator ++() noexcept ->
xtd::
index&;
106 auto operator --() noexcept ->
xtd::
index&;
107 auto operator ++(
int) noexcept ->
xtd::
index;
108 auto operator --(
int) noexcept ->
xtd::
index;
109 constexpr auto operator ~() const noexcept ->
xtd::
index {
return xtd::index {~__v__};}
110 constexpr auto operator +() const noexcept -> xtd::
index {
return xtd::index {+__v__};}
111 constexpr auto operator +(
xtd::integer auto v)
const noexcept -> xtd::index {
return xtd::index {__v__ +
static_cast<value_type>(
v)};}
112 constexpr auto operator -(
xtd::integer auto v)
const noexcept -> xtd::index {
return xtd::index {__v__ -
static_cast<value_type>(
v)};}
113 constexpr auto operator *(
xtd::integer auto v)
const noexcept -> xtd::index {
return xtd::index {__v__ *
static_cast<value_type>(
v)};}
114 constexpr auto operator /(
xtd::integer auto v)
const noexcept -> xtd::index {
return xtd::index {__v__ /
static_cast<value_type>(
v)};}
115 constexpr auto operator %(
xtd::integer auto v)
const noexcept -> xtd::index {
return xtd::index {__v__ %
static_cast<value_type>(
v)};}
215template<
typename type_t,
typename allocator_t>
218template<
typename type_t,
typename allocator_t>
221template<
typename type_t,
typename allocator_t>
224template<
typename type_t,
typename allocator_t>
227template<
typename type_t,
typename list_t>
230template<
typename type_t,
typename list_t>
233template<
typename type_t,
typename list_t>
236template<
typename type_t,
typename list_t>
238 return self().operator [](index);
virtual auto operator()(xtd::usize index) const -> const type_t &
Gets the element at the specified index.
Definition list_common.hpp:48
auto operator[](const xtd::index &index) const -> const type_t &
Gets the element at the specified index.
Internal vector-like container used as a storage backend for xtd collections.
Definition raw_array.hpp:38
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:23
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:40
Definition integer.hpp:12
Definition logical.hpp:13
Contains xtd::collections::generic::helpers::equator struct.
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.hpp:43
std::size_t usize
Represents an unsigned size of any object in bytes.
Definition usize.hpp:22
@ integer
Indicates that the allow_leading_white, allow_trailing_white, and allow_leading_sign styles are used....
Definition number_styles.hpp:44
@ v
The V key.
Definition console_key.hpp:130
Contains xtd::iequatable interface.
Contains xtd::integer concept.
Contains xtd::collections::generic::extensions::list_common class.
Contains xtd::index suffixes.
Contains xtd::logical concept.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
const type_t & reference
Represents the read_only_span reference type.
Definition read_only_span.hpp:73
const type_t & const_reference
Represents the read_only_span const reference type.
Definition read_only_span.hpp:75
constexpr auto length() const noexcept -> size_type
Returns the length of the current read_only_span.
Definition read_only_span.hpp:209
constexpr auto size() const noexcept -> size_type
Returns the number of elements.
Definition read_only_span.hpp:213
Contains xtd::npos constant.
Contains xtd::object class.
Contains xtd::collections::generic::helpers::raw_array class.
Represents a type that can be used to index a collection either from the beginning or the end.
Definition index.hpp:38
static constexpr auto from_end(xtd::integer auto value)
Creates an xtd::ndex from the end of a collection at a specified index position.
Definition index.hpp:181
auto to_string() const noexcept -> xtd::string override
Returns the string representation of the current Range object.
xtd::usize value_type
Represents the xtd::index index type.
Definition index.hpp:43
static constexpr auto from_start(xtd::integer auto value)
Creates an xtd::ndex from the start of a collection at a specified index position.
Definition index.hpp:186
static const index start
Represents the index of the first valid element in a collection.
Definition index.hpp:172
static auto parse(const xtd::string &value) -> xtd::index
Converts the string to xtd::index equivalent.
static const index end
Represents a value that is not a valid position in a collection.
Definition index.hpp:136
static const index last
Represents the index of the last valid element in a collection.
Definition index.hpp:154
constexpr index() noexcept=default
Instantiates a new xtd::index instance.
constexpr index(xtd::integer auto value) noexcept
Initializes a new xtd::index with a specified index position and a value that indicates if the index ...
Definition index.hpp:59
auto equals(const object &obj) const noexcept -> bool override
Determines whether the specified object is equal to the current object.
constexpr auto to_usize() const noexcept -> value_type
Returns the xtd::usize representation of the current Range object.
Definition index.hpp:101
static auto try_parse(const xtd::string &value, xtd::index &result) noexcept -> bool
Converts the string to xtd::index equivalent. A return value indicates whether the conversion succeed...
constexpr auto is_from_end() const noexcept -> bool
Gets a value that indicates whether the index is from the start or the end.
Definition index.hpp:71
auto get_offset(value_type length) const noexcept -> xtd::usize
Calculates the offset from the start of the collection using the specified collection length.
constexpr auto value() const noexcept -> value_type
Gets an xtd::index that represents the exclusive end index of the range.
Definition index.hpp:67
auto get_hash_code() const noexcept -> xtd::usize override
Serves as a hash function for a particular type.
auto equals(const index &value) const noexcept -> bool override
Indicates whether the current object is equal to another object of the same type.
Contains xtd::usize type.