31 template <
class enumerable_t,
class source_t>
42 template <
class type_t>
46 template <
class type_t>
59 auto aggregate(
const std::function<source_t(
const source_t&,
const source_t&)>&
func)
const -> source_t {
69 auto aggregate(
const source_t& seed,
const std::function<source_t(
const source_t&,
const source_t&)>&
func)
const -> source_t {
80 template<
class accumulate_t>
81 auto aggregate(
const accumulate_t& seed,
const std::function<accumulate_t(
const accumulate_t&,
const source_t&)>&
func)
const -> accumulate_t {
92 auto aggregate(
const source_t& seed,
const std::function<source_t(
const source_t&,
const source_t&)>&
func,
const std::function<source_t(
const source_t&)>& result_selector)
const -> source_t {
105 template<
class result_t,
class accumulate_t>
106 auto aggregate(
const accumulate_t& seed,
const std::function<accumulate_t(
const accumulate_t&,
const source_t&)>&
func,
const std::function<result_t(
const accumulate_t&)>& result_selector)
const -> result_t {
116 auto all(
const std::function<
bool(
const source_t&)>&
predicate)
const ->
bool {
125 auto any() const noexcept ->
bool {
134 auto any(
const std::function<
bool(
const source_t&)>&
predicate)
const ->
bool {
144 auto append(
const source_t& element)
const noexcept {
168 template <
class result_t>
192 auto contains(
const source_t& value)
const noexcept ->
bool {
237 template <
class key_t>
238 auto count_by(
const std::function<key_t(
const source_t&)>& key_selector)
const noexcept {
250 template <
class key_t>
286 auto first_or_default(
const std::function<
bool(
const source_t&)>&
predicate,
const source_t& default_value)
const noexcept -> source_t {
328 auto order_by(
const std::function<source_t(
const source_t&)>& key_selector)
const {
337 template<
class key_t>
356 template<
class key_t>
357 auto order_by(
const std::function<key_t(
const source_t&)>& key_selector)
const {
369 template<
class result_t>
370 auto select(
const std::function<result_t(
const source_t&)>& selector)
const {
380 auto select(
const std::function<source_t(
const source_t&)>& selector)
const {
391 template<
class result_t>
392 auto select(
const std::function<result_t(
const source_t&,
size_t index)>& selector)
const {
402 auto select(
const std::function<source_t(
const source_t&,
size_t index)>& selector)
const {
435 auto where(
const std::function<
bool(
const source_t&,
size_t)>&
predicate)
const {
441 auto self() const noexcept -> const enumerable_t& {
return static_cast<const enumerable_t&
>(*this);}
448#define __XTD_CORE_INTERNAL__
450#undef __XTD_CORE_INTERNAL__
Contains opaque_xtd_linq_enumerable_collection <type_t> struct.
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:64
Provides a base class for implementations of the xtd::collections::generic::icomparer <type_t> generi...
Definition comparer.hpp:33
Provides a set of static methods for querying objects that implement ienumerable <type_t>.
Definition enumerable.hpp:32
auto any(const std::function< bool(const source_t &)> &predicate) const -> bool
Determines whether any element of a sequence satisfies a condition.
Definition enumerable.hpp:134
auto select(const std::function< source_t(const source_t &, size_t index)> &selector) const
Projects each element of a sequence into a new form by incorporating the element's index.
Definition enumerable.hpp:402
auto count() const noexcept -> xtd::size
Returns the number of elements in current sequence.
Definition enumerable.hpp:209
auto contains(const source_t &value) const noexcept -> bool
Determines whether a sequence contains a specified element by using the default equality comparer.
Definition enumerable.hpp:192
auto first_or_default(const std::function< bool(const source_t &)> &predicate) const noexcept -> source_t
Returns the first element of the sequence that satisfies a condition or a default value if no such el...
Definition enumerable.hpp:292
auto order_by(const std::function< key_t(const source_t &)> &key_selector) const
Sorts the elements of a sequence in ascending order according to a key.
Definition enumerable.hpp:357
auto all(const std::function< bool(const source_t &)> &predicate) const -> bool
Determines whether all elements of a sequence satisfy a condition.
Definition enumerable.hpp:116
auto where(const std::function< bool(const source_t &, size_t)> &predicate) const
Filters a sequence of values based on a predicate. Each element's index is used in the logic of the p...
Definition enumerable.hpp:435
auto to_list() const noexcept -> list< source_t >
Creates a xtd::collections::generic::list <type_t> from an xtd::collections::generic::ienumerable <ty...
typename xtd::linq::enumerable::list< type_t > list
Represents the list value type.
Definition enumerable.hpp:47
auto count(const std::function< bool(const source_t &)> &predicate) const noexcept -> xtd::size
Returns a number that represents how many elements in the specified sequence satisfy a condition.
Definition enumerable.hpp:219
auto count_by(const std::function< key_t(const source_t &)> &key_selector) const noexcept
Returns the count of elements in the current sequence grouped by key.
Definition enumerable.hpp:238
auto to_array() const noexcept -> xtd::array< source_t >
Creates a xtd::array <type_t> from an xtd::collections::generic::ienumerable <type_t>.
auto average() const noexcept
Computes the average of a sequence of source_t values.
Definition enumerable.hpp:160
auto default_if_empty(const source_t &default_value) const noexcept
Returns the elements of the specified sequence or the specified value in a singleton collection if th...
Definition enumerable.hpp:264
auto order_by_descending(const std::function< key_t(const source_t &)> &key_selector) const
Sorts the elements of a sequence in descending order according to a key.
Definition enumerable.hpp:338
auto aggregate(const source_t &seed, const std::function< source_t(const source_t &, const source_t &)> &func) const -> source_t
Applies an accumulator function over a sequence. The specified seed value is used as the initial accu...
Definition enumerable.hpp:69
auto default_if_empty() const noexcept
Returns the elements of the specified sequence or the type parameter's default value in a singleton c...
Definition enumerable.hpp:257
source_t source_type
Represents the ienumerable source type.
Definition enumerable.hpp:40
auto any() const noexcept -> bool
Determines whether a sequence contains any elements.
Definition enumerable.hpp:125
auto first_or_default(const std::function< bool(const source_t &)> &predicate, const source_t &default_value) const noexcept -> source_t
Returns the first element of the sequence that satisfies a condition, or a specified default value if...
Definition enumerable.hpp:286
auto aggregate(const std::function< source_t(const source_t &, const source_t &)> &func) const -> source_t
Applies an accumulator function over a sequence.
Definition enumerable.hpp:59
auto aggregate(const accumulate_t &seed, const std::function< accumulate_t(const accumulate_t &, const source_t &)> &func) const -> accumulate_t
Applies an accumulator function over a sequence. The specified seed value is used as the initial accu...
Definition enumerable.hpp:81
auto count(const source_t &value) const noexcept -> xtd::size
Returns the number of elements with the specified value.
Definition enumerable.hpp:226
auto first_or_default(const source_t default_value) const noexcept -> source_t
Returns the first element of the sequence that satisfies a condition or a default value if no such el...
Definition enumerable.hpp:299
auto contains(const source_t &value, const xtd::collections::generic::iequality_comparer< source_t > &comparer) const noexcept -> bool
Determines whether a sequence contains a specified element by using a specified equality comparer.
Definition enumerable.hpp:200
auto chunk(size_t size) const
Splits the elements of a sequence into chunks of size at most size.
Definition enumerable.hpp:178
auto cast() const noexcept
Casts the elements of an xtd::collections::generic::ienumerable to the specified type.
Definition enumerable.hpp:169
auto order(const xtd::collections::generic::icomparer< source_t > &comparer)
Sorts the elements of a sequence in ascending order.
Definition enumerable.hpp:319
auto order_by_descending(const std::function< source_t(const source_t &)> &key_selector) const
Sorts the elements of a sequence in descending order according to a key.
Definition enumerable.hpp:347
auto distinct(const xtd::collections::generic::iequality_comparer< source_t > &comparer) const noexcept
Returns distinct elements from a sequence by using a specified xtd::collections::generic::iequality_c...
Definition enumerable.hpp:278
auto order_by(const std::function< source_t(const source_t &)> &key_selector) const
Sorts the elements of a sequence in ascending order according to a key.
Definition enumerable.hpp:328
auto select(const std::function< source_t(const source_t &)> &selector) const
Projects each element of a sequence into a new form.
Definition enumerable.hpp:380
auto aggregate(const accumulate_t &seed, const std::function< accumulate_t(const accumulate_t &, const source_t &)> &func, const std::function< result_t(const accumulate_t &)> &result_selector) const -> result_t
Applies an accumulator function over a sequence. The specified seed value is used as the initial accu...
Definition enumerable.hpp:106
auto aggregate(const source_t &seed, const std::function< source_t(const source_t &, const source_t &)> &func, const std::function< source_t(const source_t &)> &result_selector) const -> source_t
Applies an accumulator function over a sequence. The specified seed value is used as the initial accu...
Definition enumerable.hpp:92
auto where(const std::function< bool(const source_t &)> &predicate) const
Filters a sequence of values based on a predicate.
Definition enumerable.hpp:426
auto count_by(const std::function< key_t(const source_t &)> &key_selector, const iequality_comparer< key_t > &key_comparer) const noexcept
Returns the count of elements in the current sequence grouped by key.
Definition enumerable.hpp:251
auto select(const std::function< result_t(const source_t &)> &selector) const
Projects each element of a sequence into a new form.
Definition enumerable.hpp:370
auto append(const source_t &element) const noexcept
Appends a value to the end of the sequence.
Definition enumerable.hpp:144
auto select(const std::function< result_t(const source_t &, size_t index)> &selector) const
Projects each element of a sequence into a new form by incorporating the element's index.
Definition enumerable.hpp:392
auto as_enumerable() const noexcept
Returns the input typed as xtd::collections::generic::ienumerable <type_t>.
Definition enumerable.hpp:153
typename xtd::linq::enumerable::ienumerable< type_t > ienumerable
Represents the ienumerable value type.
Definition enumerable.hpp:43
auto distinct() const noexcept
Returns distinct elements from a sequence by using the default equality comparer to compare values.
Definition enumerable.hpp:270
auto first_or_default() const noexcept -> source_t
Returns the first element of the sequence that satisfies a condition or a default value if no such el...
Definition enumerable.hpp:305
enumerable_t enumerable_type
Represents the ienumerable enumerable type.
Definition enumerable.hpp:38
auto order()
Sorts the elements of a sequence in ascending order.
Definition enumerable.hpp:312
auto concat(const ienumerable< source_t > &second) const noexcept
Concatenates two sequences.
Definition enumerable.hpp:185
Exposes a method that compares two objects.
Definition icomparer.hpp:30
Defines methods to support the comparison of objects for equality.
Definition iequality_comparer.hpp:34
static auto select(const ienumerable< source_t > &source, const std::function< result_t(const source_t &)> &selector)
Projects each element of a sequence into a new form.
Definition enumerable.hpp:915
static xtd::decimal average(const ienumerable< xtd::decimal > &source)
Computes the average of a sequence of xtd::decimal values.
static auto default_if_empty(const ienumerable< source_t > &source) noexcept
Returns the elements of the specified sequence or the type parameter's default value in a singleton c...
Definition enumerable.hpp:601
static auto append(const ienumerable< source_t > &source, const source_t &element) noexcept
Appends a value to the end of the sequence.
Definition enumerable.hpp:234
static bool all(const ienumerable< source_t > &source, const std::function< bool(const source_t &)> &predicate)
Determines whether all elements of a sequence satisfy a condition.
Definition enumerable.hpp:192
typename xtd::collections::generic::ienumerable< type_t > ienumerable
Represents the ienumerable value type.
Definition enumerable.hpp:82
static auto cast(const ienumerable< source_t > &source) noexcept
Casts the elements of an xtd::collections::generic::ienumerable to the specified type.
static bool any(const ienumerable< source_t > &source) noexcept
Determines whether a sequence contains any elements.
Definition enumerable.hpp:207
static const auto & as_enumerable(const ienumerable< source_t > &source) noexcept
Returns the input typed as xtd::collections::generic::ienumerable <type_t>.
Definition enumerable.hpp:291
typename xtd::collections::generic::list< type_t > list
Represents the list value type.
Definition enumerable.hpp:86
static auto chunk(const ienumerable< source_t > &source, xtd::size size)
Splits the elements of a sequence into chunks of size at most size.
static bool contains(const ienumerable< source_t > &source, const source_t &value) noexcept
Determines whether a sequence contains a specified element by using the default equality comparer.
Definition enumerable.hpp:493
static source_t first_or_default(const ienumerable< source_t > &source, const std::function< bool(const source_t &)> &predicate, const source_t &default_value) noexcept
Returns the first element of the sequence that satisfies a condition, or a specified default value if...
Definition enumerable.hpp:654
static auto concat(const ienumerable< source_t > &first, const ienumerable< source_t > &second) noexcept
Concatenates two sequences.
Definition enumerable.hpp:478
static auto order_by_descending(const ienumerable< source_t > &source, const std::function< key_t(const source_t &)> &key_selector)
Sorts the elements of a sequence in descending order according to a key.
Definition enumerable.hpp:828
static auto distinct(const ienumerable< source_t > &source) noexcept
Returns distinct elements from a sequence by using the default equality comparer to compare values.
Definition enumerable.hpp:626
static auto order_by(const ienumerable< source_t > &source, const std::function< key_t(const source_t &)> &key_selector)
Sorts the elements of a sequence in ascending order according to a key.
Definition enumerable.hpp:800
static auto order(const ienumerable< source_t > &source)
Sorts the elements of a sequence in ascending order.
Definition enumerable.hpp:778
static auto where(const ienumerable< source_t > &source, const std::function< bool(const source_t &)> &predicate)
Filters a sequence of values based on a predicate.
Definition enumerable.hpp:1001
static auto count_by(const ienumerable< source_t > &source, const std::function< key_t(const source_t &)> &key_selector) noexcept
Returns the count of elements in the source sequence grouped by key.
Definition enumerable.hpp:560
static xtd::size count(const ienumerable< source_t > &source) noexcept
Returns the number of elements in a sequence.
Definition enumerable.hpp:520
static source_t aggregate(const ienumerable< source_t > &source, const std::function< source_t(const source_t &, const source_t &)> &func)
Applies an accumulator function over a sequence.
Definition enumerable.hpp:105
Contains foreach_ keyword.
Contains xtd::collections::generic::ienumerable <type_t> interface.
xtd::delegate< result_t(arguments_t... arguments)> func
Represents a delegate that has variables parameters and returns a value of the type specified by the ...
Definition func.hpp:27
size_t size
Represents a size of any object in bytes.
Definition size.hpp:23
xtd::func< bool, type_t > predicate
Represents a delegate that defines a set of criteria and determines whether the specified object meet...
Definition predicate.hpp:16
Contains xtd::linq::enumerable <type_t> class.
The xtd::extensions namespace contains interface extensions.
Definition collection_common.hpp:14
The xtd::collections::generic namespace contains interfaces and classes that define generic collectio...
Definition comparer.hpp:16
The xtd::collections namespace contains interfaces and classes that define various collections of obj...
Definition any_pair.hpp:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8