31 struct index :
public xtd::object, xtd::iequatable<index> {
43 constexpr index() noexcept = default;
48 constexpr index(xtd::integer auto value, xtd::logical auto from_end) noexcept : __v__{
static_cast<value_type>(from_end ? ~value :
value)} {}
52 constexpr explicit index(
xtd::integer auto value) noexcept : index {
value,
false} {}
60 [[nodiscard]]
constexpr auto value() const noexcept -> value_type {
return is_from_end() ? ~__v__ : __v__;}
62 [[nodiscard]]
constexpr auto is_from_end() const noexcept ->
bool {
return __v__ > std::numeric_limits<value_type>::max() / 2;}
71 [[nodiscard]]
constexpr auto equals(
const object& obj)
const noexcept ->
bool override {
return is<index>(obj) &&
equals(
static_cast<const index&
>(obj));}
75 [[nodiscard]]
constexpr auto equals(
const index& value)
const noexcept ->
bool override {
return xtd::collections::generic::helpers::equator<value_type> {}(__v__,
value.__v__);}
79 [[nodiscard]]
constexpr auto get_hash_code() const noexcept -> xtd::usize
override {
return hash_code::combine(__v__);}
84 [[nodiscard]]
constexpr auto get_offset(value_type length)
const noexcept ->
xtd::usize {
return is_from_end() ?
length -
value() :
value();}
88 [[nodiscard]]
auto to_string() const noexcept -> xtd::
string override;
96 operator value_type() {
return __v__;}
99 constexpr operator value_type()
const {
return __v__;}
120 static const index
end;
138 static const index
last;
156 static const index
start;
165 inline static constexpr auto from_end(
xtd::integer auto value) {
return index {
value,
true};}
170 inline static constexpr auto from_start(
xtd::integer auto value) {
return index {
value};}
180inline constexpr const xtd::index xtd::index::end {0,
true};
181inline constexpr const xtd::index xtd::index::last {1,
true};
182inline constexpr const xtd::index xtd::index::start {0};
188template<
typename type_t,
typename allocator_t>
191template<
typename type_t,
typename allocator_t>
194template<
typename type_t,
typename list_t>
197template<
typename type_t,
typename list_t>
200template<
typename type_t,
typename list_t>
203template<
typename type_t,
typename list_t>
205 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:34
Contains xtd::collections::generic::helpers::equator struct.
@ value
Represnets the constant operator precedence (42).
Definition operator_precedence.hpp:30
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
@ start
Starting of a logical operation.
Definition trace_event_type.hpp:37
Contains xtd::iequatable interface.
Contains xtd::integer concept.
Contains xtd::collections::generic::extensions::list_common class.
Contains xtd::usize 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:70
auto to_string() const noexcept -> xtd::string override
Returns the string representation of this xtd::read_only_span <type_t> object.
Definition read_only_span.hpp:355
const type_t & const_reference
Represents the read_only_span const reference type.
Definition read_only_span.hpp:72
auto equals(const object &obj) const noexcept -> bool override
Determines whether the specified object is equal to the current object.
Definition read_only_span.hpp:252
auto last() const -> read_only_span< type_t, count >
Obtains a subspan consisting of the last N elements of the sequence.
Definition read_only_span.hpp:287
constexpr auto length() const noexcept -> size_type
Returns the length of the current read_only_span.
Definition read_only_span.hpp:226
auto get_hash_code() const noexcept -> xtd::usize override
Serves as a hash function for a particular type.
Definition read_only_span.hpp:276
auto end() const -> const_iterator
Returns an iterator to the end.
Definition read_only_span.hpp:218
constexpr auto size() const noexcept -> size_type
Returns the number of elements.
Definition read_only_span.hpp:230
std::add_cv_t< type_t > value_type
Represents the read_only_span value type.
Definition read_only_span.hpp:60
Contains xtd::npos constant.
Contains xtd::object class.
Contains xtd::collections::generic::helpers::raw_array class.
Contains xtd::usize type.