xtd 0.2.0
Loading...
Searching...
No Matches
xtd::ranges::views::distinct_view Class Reference

Definition

The xtd::ranges::views::distinct_view class is used to distinct elements from a sequence.

Definition
The xtd::ranges::views::distinct_view class is used to distinct elements from a sequence.
Definition distinct_view.hpp:44
Header
#include <xtd/ranges/views/distinct_view>
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...
constexpr auto distinct
The xtd::ranges::views::distinct_view instance.
Definition distinct.hpp:40
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]

Public Operators

template<std::ranges::range range_t>
auto operator() (range_t &&source) const
 Returns distinct elements from a sequence by using the default equality comparer to compare values.
 
template<std::ranges::range range_t, typename comparer_t>
auto operator() (range_t &&source, const comparer_t &comparer) const
 Returns distinct elements from a sequence by using a specified xtd::collections::generic::iequality_comparer <type_t> to compare values.
 
template<typename comparer_t>
auto operator() (const comparer_t &comparer) const
 Returns distinct elements from a sequence by using a specified xtd::collections::generic::iequality_comparer <type_t> to compare values.
 

Member Function Documentation

◆ operator()() [1/3]

template<std::ranges::range range_t>
auto xtd::ranges::views::distinct_view::operator() ( range_t && source) const
inline

Returns distinct elements from a sequence by using the default equality comparer to compare values.

Parameters
sourceThe sequence to remove duplicate elements from.
Returns
An iterable distinct elements from the source sequence.

◆ operator()() [2/3]

template<std::ranges::range range_t, typename comparer_t>
auto xtd::ranges::views::distinct_view::operator() ( range_t && source,
const comparer_t & comparer ) const
inline

Returns distinct elements from a sequence by using a specified xtd::collections::generic::iequality_comparer <type_t> to compare values.

Parameters
sourceThe sequence to remove duplicate elements from.
comparerAn xtd::collections::generic::iequality_comparer <type_t> to compare values.
Returns
An iterable distinct elements from the source sequence.

◆ operator()() [3/3]

template<typename comparer_t>
auto xtd::ranges::views::distinct_view::operator() ( const comparer_t & comparer) const
inline

Returns distinct elements from a sequence by using a specified xtd::collections::generic::iequality_comparer <type_t> to compare values.

Parameters
comparerAn xtd::collections::generic::iequality_comparer <type_t> to compare values.
Returns
An iterable distinct elements from the source sequence.

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