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::where_view
 The xtd::ranges::views::where_view class is used to filter elements from a sequence. More...
 

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::where
 The xtd::ranges::views::where instance.
 

Variable Documentation

◆ distinct

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

#include <xtd.core/include/xtd/ranges/views/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:63
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 <xtd.core/include/xtd/ranges/views/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]

◆ order_by_descending

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

#include <xtd.core/include/xtd/ranges/views/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 <xtd.core/include/xtd/ranges/views/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]
@ select
The SELECT key.
Definition console_key.hpp:54
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]

◆ where

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

#include <xtd.core/include/xtd/ranges/views/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]