60 [[nodiscard]]
constexpr auto end() const noexcept -> const
index_type& {
return end_;}
63 [[nodiscard]]
constexpr auto start() const noexcept -> const
index_type& {
return start_;}
72 [[nodiscard]]
auto equals(
const object& obj)
const noexcept ->
bool override {
return is<range>(obj) &&
equals(
static_cast<const range&
> (obj));}
92 [[nodiscard]]
static auto all() noexcept ->
xtd::
range {
return range {xtd::index::start, xtd::index::end};}
101 [[nodiscard]]
static auto end_at(
index_type end)
noexcept -> xtd::range {
return range {xtd::index::start,
end};}
124template<xtd::iterable source_t>
128 return invoke_take_with_range(source, range);
131template<
typename source_t>
132requires(!
requires (
const xtd::raw_type<source_t>& source) {{source.size()} -> std::convertible_to<std::size_t>;})
136 auto result = std::vector<xtd::iterable_value_type<source_t>> {source.begin(), source.end()};
137 return invoke_take_with_range(result, range);
140template<
typename source_t>
141requires(
requires (
const xtd::raw_type<source_t>& source) {{source.size()} -> std::convertible_to<std::size_t>;})
144 auto skip =
range.start();
145 auto count = skip +
range.end() -
range.start();
149 for (
const auto& item : source) {
150 if (index++ < skip)
continue;
151 if (index++ == count)
break;
Represents an enumerable generator that supports deferred, lazy iteration over a collection of a spec...
Definition enumerable_generator.hpp:44
static auto combine(args_t... values) noexcept -> xtd::usize
Combines values into a hash code.
Definition hash_code.hpp:70
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:23
static auto take(source_t &&source, xtd::usize count) -> xtd::collections::generic::enumerable_generator< xtd::iterable_value_type< source_t > >
Returns a specified number of contiguous elements from the start of a sequence.
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:40
Represents a range that has start and end indexes.
Definition range.hpp:28
auto get_hash_code() const noexcept -> size_type override
Serves as a hash function for a particular type.
Definition range.hpp:80
auto to_string() const noexcept -> xtd::string override
Returns the string representation of the current Range object.
Definition range.hpp:84
xtd::index index_type
Represents the xtd::range index type.
Definition range.hpp:34
constexpr auto start() const noexcept -> const index_type &
Gets the inclusive start index of the Range.
Definition range.hpp:63
static auto end_at(xtd::integer auto end) noexcept -> xtd::range
Creates a xtd::range object starting from the first element in the collection to a specified end inde...
Definition range.hpp:105
xtd::usize size_type
Represents the size type.
Definition range.hpp:37
auto equals(const object &obj) const noexcept -> bool override
Determines whether the specified object is equal to the current object.
Definition range.hpp:72
range(xtd::integer auto start, const xtd::integer auto end) noexcept
Instantiates a new xtd::range instance with the specified starting and ending indexes.
Definition range.hpp:52
constexpr auto end() const noexcept -> const index_type &
Gets an Index that represents the exclusive end index of the range.
Definition range.hpp:60
static auto start_at(xtd::integer auto start) noexcept -> xtd::range
Creates a new xtd::range object starting from a specified start index to the end of the collection.
Definition range.hpp:114
static auto start_at(index_type start) noexcept -> xtd::range
Creates a new xtd::range object starting from a specified start index to the end of the collection.
Definition range.hpp:110
auto equals(const range &value) const noexcept -> bool override
Indicates whether the current object is equal to another object of the same type.
Definition range.hpp:76
range() noexcept=default
Instantiates a new xtd::range instance.
Definition integer.hpp:12
auto range(type_t count)
Generates a sequence of integral numbers within a specified range.
Definition range.hpp:39
std::size_t usize
Represents an unsigned size of any object in bytes.
Definition usize.hpp:22
std::remove_cvref_t< value_t > raw_type
Represents a raw type alias equivalent to std::remove_cvref_t<value_t>.
Definition raw_type.hpp:25
auto is(xtd::any value) -> bool
Checks if the result of an expression is compatible with a given type.
Definition is.hpp:485
Contains xtd::index struct.
Contains xtd::linq::enumerable <type_t> class.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
auto end() const -> const_iterator
Returns an iterator to the end.
Definition read_only_span.hpp:219
Contains xtd::npos constant.
Contains xtd::object class.
Implements a function object for performing comparisons. Unless specialised, invokes operator== on ty...
Definition equator.hpp:39
Contains xtd::usize type.
Contains xtd::usize_object alias.