xtd 1.0.0
Loading...
Searching...
No Matches
xtd::range Class Reference
Inheritance diagram for xtd::range:
xtd::object xtd::iequatable< range >

Definition

Represents a range that has start and end indexes.

class range : public xtd::object;
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:40
range() noexcept=default
Instantiates a new xtd::range instance.
Header
#include <xtd/range>
Namespace
xtd
Library
xtd.core

Public Aliases

using index_type
 Represents the xtd::range index type.
using size_type
 Represents the size type.

Public Constructors

 range () noexcept=default
 Instantiates a new xtd::range instance.
 range (const index_type &start, const index_type &end) noexcept
 Instantiates a new xtd::range instance with the specified starting and ending indexes.
 range (xtd::integer auto start, const xtd::integer auto end) noexcept
 Instantiates a new xtd::range instance with the specified starting and ending indexes.

Public Properties

constexpr auto end () const noexcept -> const index_type &
 Gets an Index that represents the exclusive end index of the range.
constexpr auto start () const noexcept -> const index_type &
 Gets the inclusive start index of the Range.

Public Methods

Determines whether the specified object is equal to the current object.

Parameters
objThe object to compare with the current object.
Returns
true if the specified object is equal to the current object. otherwise, false.
constexpr auto equals (const object &obj) const noexcept -> bool override
 Determines whether the specified object is equal to the current object.
constexpr auto equals (const range &value) const noexcept -> bool override
 Indicates whether the current object is equal to another object of the same type.
constexpr auto get_hash_code () const noexcept -> size_type override
 Serves as a hash function for a particular type.
auto to_string () const noexcept -> xtd::string override
 Returns the string representation of the current Range object.

Public Static Properties

Gets a xtd::range object that starts from the first element to the end.

Returns
A range from the start to the end.
static auto all () noexcept -> xtd::range

Public Static Methods

Creates a xtd::range object starting from the first element in the collection to a specified end index.

Parameters
endThe position of the last element up to which the Range object will be created.
Returns
A range that starts from the first element to end.
static auto end_at (index_type end) noexcept -> xtd::range
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 index.
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.
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.

Additional Inherited Members

 object ()=default
 Create a new instance of the ultimate base class object.
virtual auto get_type () const noexcept -> type_object
 Gets the type of the current instance.
template<typename object_t>
auto memberwise_clone () const -> xtd::unique_ptr_object< object_t >
 Creates a shallow copy of the current object.
template<typename object_a_t, typename object_b_t>
static auto equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool
 Determines whether the specified object instances are considered equal.
template<typename object_a_t, typename object_b_t>
static auto reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool
 Determines whether the specified object instances are the same instance.

Member Typedef Documentation

◆ index_type

Represents the xtd::range index type.

◆ size_type

Represents the size type.

Constructor & Destructor Documentation

◆ range() [1/3]

xtd::range::range ( )
defaultnoexcept

Instantiates a new xtd::range instance.

◆ range() [2/3]

xtd::range::range ( const index_type & start,
const index_type & end )
inlinenoexcept

Instantiates a new xtd::range instance with the specified starting and ending indexes.

Parameters
startThe inclusive start index of the range.
endThe exclusive end index of the range.

◆ range() [3/3]

xtd::range::range ( xtd::integer auto start,
const xtd::integer auto end )
inlinenoexcept

Instantiates a new xtd::range instance with the specified starting and ending indexes.

Parameters
startThe inclusive start index of the range.
endThe exclusive end index of the range.

Member Function Documentation

◆ end()

auto xtd::range::end ( ) const -> const index_type &
inlinenodiscardconstexprnoexcept

Gets an Index that represents the exclusive end index of the range.

Returns
The end index of the range.

◆ start()

auto xtd::range::start ( ) const -> const index_type &
inlinenodiscardconstexprnoexcept

Gets the inclusive start index of the Range.

Returns
The inclusive start index of the range.

◆ equals() [1/2]

auto xtd::range::equals ( const object & obj) const -> bool
inlinenodiscardconstexproverridevirtualnoexcept

Determines whether the specified object is equal to the current object.

Parameters
objThe object to compare with the current object.
Returns
true if the specified object is equal to the current object. otherwise, false.
Examples
The following code example compares the current instance with another object.
#include <xtd/xtd>
auto main() -> int {
auto object1 = new_ptr<object>();
auto object2 = new_ptr<object>();
auto object3 = object2;
console::write_line(object1->equals(*object3));
console::write_line(*object1 == *object3);
object3 = object1;
console::write_line(object1->equals(*object3));
console::write_line(*object1 == *object3);
}
// This code produces the following output :
//
// false
// false
// true
// true
static auto write_line() -> void
Writes the current line terminator to the standard output stream using the specified format informati...
auto new_ptr(args_t &&... args) -> xtd::ptr< type_t >
The xtd::new_ptr operator creates a xtd::ptr object.
Definition new_ptr.hpp:24

Reimplemented from xtd::object.

◆ equals() [2/2]

auto xtd::range::equals ( const range & value) const -> bool
inlinenodiscardconstexproverridevirtualnoexcept

Indicates whether the current object is equal to another object of the same type.

Parameters
objAn object to compare with this object.
Returns
true if the current object is equal to the other parameter; otherwise, false.

Implements xtd::iequatable< range >.

◆ get_hash_code()

auto xtd::range::get_hash_code ( ) const -> size_type
inlinenodiscardconstexproverridevirtualnoexcept

Serves as a hash function for a particular type.

Returns
A hash code for the current object.

Reimplemented from xtd::object.

◆ to_string()

auto xtd::range::to_string ( ) const -> xtd::string
inlinenodiscardoverridevirtualnoexcept

Returns the string representation of the current Range object.

Returns
The string representation of the range.

Reimplemented from xtd::object.

◆ end_at()

auto xtd::range::end_at ( xtd::integer auto end) -> xtd::range
inlinestaticnodiscardnoexcept

Creates a xtd::range object starting from the first element in the collection to a specified end index.

Parameters
endThe position of the last element up to which the Range object will be created.
Returns
A range that starts from the first element to end.

◆ start_at() [1/2]

auto xtd::range::start_at ( index_type start) -> xtd::range
inlinestaticnodiscardnoexcept

Creates a new xtd::range object starting from a specified start index to the end of the collection.

Parameters
startThe position of the first element from which the Range will be created.
Returns
A range from start to the end of the collection.

◆ start_at() [2/2]

auto xtd::range::start_at ( xtd::integer auto start) -> xtd::range
inlinestaticnodiscardnoexcept

Creates a new xtd::range object starting from a specified start index to the end of the collection.

Parameters
startThe position of the first element from which the Range will be created.
Returns
A range from start to the end of the collection.

The documentation for this class was generated from the following file: