xtd 0.2.0
Loading...
Searching...
No Matches

Definition

Contains ranges definitions.

Classes

class  xtd::ranges::views::distinct_view
 The xtd::ranges::views::distinct_view class is used to distinct elements from a sequence. More...
class  xtd::ranges::views::order_by_descending_view
 The xtd::ranges::views::order_by_descending_view class is used to sort the elements of a sequence in descending order according to a key. More...
class  xtd::ranges::views::order_by_view
 The xtd::ranges::views::order_by_view class is used to sort the elements of a sequence in ascending order according to a key. More...
class  xtd::ranges::views::select_view
 The xtd::ranges::views::select_view class is used to select elements from a sequence. More...
class  xtd::ranges::views::to_array_view
 The xtd::ranges::views::to_array_view class is used to convert a sequence to an array. More...
class  xtd::ranges::views::to_list_view
 The xtd::ranges::views::to_list_view class is used to convert a sequence to a list. More...
class  xtd::ranges::views::where_view
 The xtd::ranges::views::where_view class is used to filter elements from a sequence. More...

Functions

template<class type_t>
auto xtd::ranges::views::range (type_t count)
 Generates a sequence of integral numbers within a specified range.
template<class type_t>
auto xtd::ranges::views::range (type_t start, type_t count)
 Generates a sequence of integral numbers within a specified range.
template<class type_t>
auto xtd::ranges::views::range (type_t start, type_t count, type_t step)
 Generates a sequence of integral numbers within a specified range and step.

Variables

constexpr auto xtd::ranges::views::distinct
 The xtd::ranges::views::distinct_view instance.
constexpr auto xtd::ranges::views::order_by
 The xtd::ranges::views::order_by instance.
constexpr auto xtd::ranges::views::order_by_descending
 The xtd::ranges::views::order_by_descending instance.
constexpr auto xtd::ranges::views::select
 The xtd::ranges::views::select instance.
constexpr auto xtd::ranges::views::to_array
 The xtd::ranges::views::to_array instance.
constexpr auto xtd::ranges::views::to_list
 The xtd::ranges::views::to_list instance.
constexpr auto xtd::ranges::views::where
 The xtd::ranges::views::where instance.

Function Documentation

◆ range() [1/3]

template<class type_t>
auto xtd::ranges::views::range ( type_t count)
nodiscard

#include <range.hpp>

Generates a sequence of integral numbers within a specified range.

Parameters
countThe number of sequential integers to generate.
Returns
An xtd::collections::generic::ienumerable <xtd::int32> that contains a range of sequential integral numbers.
Definition
template<class type_t>
auto range(type_t count);
auto range(type_t count)
Generates a sequence of integral numbers within a specified range.
Definition range.hpp:39
Header
#include <xtd/ranges/views/range>
Namespace
xtd::ranges::views
Library
xtd.core

◆ range() [2/3]

template<class type_t>
auto xtd::ranges::views::range ( type_t start,
type_t count )
nodiscard

#include <range.hpp>

Generates a sequence of integral numbers within a specified range.

Parameters
startThe value of the first integer in the sequence.
countThe number of sequential integers to generate.
Returns
An xtd::collections::generic::ienumerable <xtd::int32> that contains a range of sequential integral numbers.
Definition
template<class type_t>
auto range(type_t start, type_t count);
Header
#include <xtd/ranges/views/range>
Namespace
xtd::ranges::views
Library
xtd.core

◆ range() [3/3]

template<class type_t>
auto xtd::ranges::views::range ( type_t start,
type_t count,
type_t step )
nodiscard

#include <range.hpp>

Generates a sequence of integral numbers within a specified range and step.

Parameters
startThe value of the first integer in the sequence.
countThe number of sequential integers to generate.
stepThe integer number specifying the incrementation.
Returns
An xtd::collections::generic::ienumerable that contains a range of sequential integral numbers.
Definition
template<class type_t>
auto range(type_t start, type_t count, type_t step);
Header
#include <xtd/ranges/views/range>
Namespace
xtd::ranges::views
Library
xtd.core

Variable Documentation

◆ distinct

auto xtd::ranges::views::distinct
inlineconstexpr

#include <distinct.hpp>

The xtd::ranges::views::distinct_view instance.

Definition
inline constexpr auto distinct = distinct_view {};
The xtd::ranges::views::distinct_view class is used to distinct elements from a sequence.
Definition distinct_view.hpp:44
constexpr auto distinct
The xtd::ranges::views::distinct_view instance.
Definition distinct.hpp:40
Header
#include <xtd/ranges/views/distinct>
Namespace
xtd::ranges::views
Library
xtd.core
Examples
The following example shows how to use xtd::ranges::views::distinct instance :
#include <xtd/xtd>
auto main() -> int {
auto numbers = array {2, 7, 3, 1, 1, 4, 10, 5, 3, 3, 3, 6, 6, 2, 8, 9, 8, 9};
console::write_line("numbers = {}", numbers | distinct);
}
// This code produces the following output :
//
// numbers = [2, 7, 3, 1, 4, 10, 5, 6, 8, 9]
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:64
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
The following example shows how to use xtd::ranges::views::distinct_view class :
#include <xtd/xtd>
auto main() -> int {
auto numbers = array {2, 7, 3, 1, 1, 4, 10, 5, 3, 3, 3, 6, 6, 2, 8, 9, 8, 9};
console::write_line("numbers = {}", distinct(numbers));
}
// This code produces the following output :
//
// numbers = [2, 7, 3, 1, 4, 10, 5, 6, 8, 9]

◆ order_by

auto xtd::ranges::views::order_by
inlineconstexpr

#include <order_by.hpp>

The xtd::ranges::views::order_by instance.

Definition
inline constexpr auto order_by = order_by_view {};
The xtd::ranges::views::order_by_view class is used to sort the elements of a sequence in ascending o...
Definition order_by_view.hpp:44
constexpr auto order_by
The xtd::ranges::views::order_by instance.
Definition order_by.hpp:40
Header
#include <xtd/ranges/views/order_by>
Namespace
xtd::ranges::views
Library
xtd.core
Examples
The following example shows how to use xtd::ranges::views::order_by instance :
#include <xtd/xtd>
auto main() -> int {
auto numbers = array {2, 7, 3, 1, 4, 10, 5, 6, 8, 9};
console::write_line("numbers = {}", numbers | order_by([](auto n) {return n;}));
}
// This code produces the following output :
//
// numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
@ n
The N key.
Definition console_key.hpp:114
The following example shows how to use xtd::ranges::views::order_by_view class :
#include <xtd/xtd>
auto main() -> int {
auto numbers = array {2, 7, 3, 1, 4, 10, 5, 6, 8, 9};
console::write_line("numbers = {}", order_by(numbers, [](auto n) {return n;}));
}
// This code produces the following output :
//
// numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Examples
ranges_views.cpp.

◆ order_by_descending

auto xtd::ranges::views::order_by_descending
inlineconstexpr

#include <order_by_descending.hpp>

The xtd::ranges::views::order_by_descending instance.

Definition
inline constexpr auto order_by_descending = order_by_descending_view {};
The xtd::ranges::views::order_by_descending_view class is used to sort the elements of a sequence in ...
Definition order_by_descending_view.hpp:44
constexpr auto order_by_descending
The xtd::ranges::views::order_by_descending instance.
Definition order_by_descending.hpp:40
Header
#include <xtd/ranges/views/order_by_descending>
Namespace
xtd::ranges::views
Library
xtd.core
Examples
The following example shows how to use xtd::ranges::views::order_by_descending instance :
#include <xtd/xtd>
auto main() -> int {
auto numbers = array {2, 7, 3, 1, 4, 10, 5, 6, 8, 9};
console::write_line("numbers = {}", numbers | order_by_descending([](auto n) {return n;}));
}
// This code produces the following output :
//
// numbers = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
The following example shows how to use xtd::ranges::views::order_by_descending_view class :
#include <xtd/xtd>
auto main() -> int {
auto numbers = array {2, 7, 3, 1, 4, 10, 5, 6, 8, 9};
console::write_line("numbers = {}", order_by_descending(numbers, [](auto n) {return n;}));
}
// This code produces the following output :
//
// numbers = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]

◆ select

auto xtd::ranges::views::select
inlineconstexpr

#include <select.hpp>

The xtd::ranges::views::select instance.

Definition
inline constexpr auto select = select_view {};
The xtd::ranges::views::select_view class is used to select elements from a sequence.
Definition select_view.hpp:44
constexpr auto select
The xtd::ranges::views::select instance.
Definition select.hpp:40
Header
#include <xtd/ranges/views/select>
Namespace
xtd::ranges::views
Library
xtd.core
Examples
The following example shows how to use xtd::ranges::views::select instance :
#include <xtd/xtd>
auto main() -> int {
auto numbers = array {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
console::write_line("numbers = {}", numbers | select([](auto n) {return n * n;}));
}
// This code produces the following output :
//
// numbers = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
The following example shows how to use xtd::ranges::views::select_view class :
#include <xtd/xtd>
auto main() -> int {
auto numbers = array {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
console::write_line("numbers = {}", select(numbers, [](auto n) {return n * n;}));
}
// This code produces the following output :
//
// numbers = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]

◆ to_array

auto xtd::ranges::views::to_array
inlineconstexpr

#include <to_array.hpp>

The xtd::ranges::views::to_array instance.

Definition
inline constexpr auto to_array = to_array_view {};
The xtd::ranges::views::to_array_view class is used to convert a sequence to an array.
Definition to_array_view.hpp:44
constexpr auto to_array
The xtd::ranges::views::to_array instance.
Definition to_array.hpp:40
Header
#include <xtd/ranges/views/to_array>
Namespace
xtd::ranges::views
Library
xtd.core
Examples
The following example shows how to use xtd::ranges::views::to_array instance :
The following example shows how to use xtd::ranges::views::to_array_view class :

◆ to_list

auto xtd::ranges::views::to_list
inlineconstexpr

#include <to_list.hpp>

The xtd::ranges::views::to_list instance.

Definition
inline constexpr auto to_list = to_list_view {};
The xtd::ranges::views::to_list_view class is used to convert a sequence to a list.
Definition to_list_view.hpp:44
constexpr auto to_list
The xtd::ranges::views::to_list instance.
Definition to_list.hpp:40
Header
#include <xtd/ranges/views/to_list>
Namespace
xtd::ranges::views
Library
xtd.core
Examples
The following example shows how to use xtd::ranges::views::to_list instance :
The following example shows how to use xtd::ranges::views::to_list_view class :

◆ where

auto xtd::ranges::views::where
inlineconstexpr

#include <where.hpp>

The xtd::ranges::views::where instance.

Definition
inline constexpr auto where = where_view {};
The xtd::ranges::views::where_view class is used to filter elements from a sequence.
Definition where_view.hpp:44
constexpr auto where
The xtd::ranges::views::where instance.
Definition where.hpp:40
Header
#include <xtd/ranges/views/where>
Namespace
xtd::ranges::views
Library
xtd.core
Examples
The following example shows how to use xtd::ranges::views::where instance :
#include <xtd/xtd>
auto main() -> int {
auto numbers = array {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
console::write_line("numbers = {}", numbers | where([](auto n) {return n <= 5;}));
}
// This code produces the following output :
//
// numbers = [1, 2, 3, 4, 5]
The following example shows how to use xtd::ranges::views::where_view class :
#include <xtd/xtd>
auto main() -> int {
auto numbers = array {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
console::write_line("numbers = {}", where(numbers, [](auto n) {return n <= 5;}));
}
// This code produces the following output :
//
// numbers = [1, 2, 3, 4, 5]