5#include "../../../linq/enumerable.hpp"
6#include "../../../linq/foreach.hpp"
11 namespace collections {
15 namespace extensions {
31 template <
class enumerable_t,
class source_t>
42 template <
class type_t>
46 template <
class type_t>
59 source_t
aggregate(
const std::function<source_t(
const source_t&,
const source_t&)>&
func)
const {
69 source_t
aggregate(
const source_t& seed,
const std::function<source_t(
const source_t&,
const source_t&)>&
func)
const {
80 template<
class accumulate_t>
81 accumulate_t
aggregate(
const accumulate_t& seed,
const std::function<accumulate_t(
const source_t&,
const accumulate_t&)>&
func)
const {
92 source_t
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 {
105 template<
class result_t,
class accumulate_t>
106 result_t
aggregate(
const accumulate_t& seed,
const std::function<accumulate_t(
const source_t&,
const accumulate_t&)>&
func,
const std::function<result_t(
const accumulate_t&)>& result_selector)
const {
116 bool all(
const std::function<
bool(
const source_t&)>&
predicate)
const {
125 bool any() const noexcept {
134 bool any(
const std::function<
bool(
const source_t&)>&
predicate)
const {
168 template <
class result_t>
170 return xtd::linq::enumerable::cast<result_t>(base());
192 bool contains(
const source_t& value)
const noexcept {
219 size_t count(
const std::function<
bool(
const source_t&)>&
predicate)
const noexcept {
230 template <
class key_t>
232 return xtd::linq::enumerable::count_by<key_t, source_t>(base(), key_selector);
243 template <
class key_t>
245 return xtd::linq::enumerable::count_by<key_t, source_t>(base(), key_selector, key_comparer);
296 template<
class result_t>
298 return xtd::linq::enumerable::select<result_t, source_t>(base(), selector);
318 template<
class result_t>
320 return xtd::linq::enumerable::select<result_t, source_t>(base(), selector);
361 const enumerable_t& base() const noexcept {
return static_cast<const enumerable_t&
>(*this);}
368#define __XTD_CORE_INTERNAL__
369#include "../../../internal/__enumerable_collection.hpp"
370#undef __XTD_CORE_INTERNAL__
371#include "../ienumerable.hpp"
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
const ienumerable< source_t > & 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:329
size_t count() const noexcept
Returns the number of elements in current sequence.
Definition enumerable.hpp:209
result_t aggregate(const accumulate_t &seed, const std::function< accumulate_t(const source_t &, const accumulate_t &)> &func, const std::function< result_t(const accumulate_t &)> &result_selector) const
Applies an accumulator function over a sequence. The specified seed value is used as the initial accu...
Definition enumerable.hpp:106
const ienumerable< key_value_pair< key_t, xtd::size > > & 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:231
const ienumerable< source_t > & as_enumerable() const noexcept
Returns the input typed as xtd::collections::generic::ienumerable <type_t>.
Definition enumerable.hpp:153
const ienumerable< source_t > & append(const source_t &element) const noexcept
Appends a value to the end of the sequence.
Definition enumerable.hpp:144
source_t aggregate(const std::function< source_t(const source_t &, const source_t &)> &func) const
Applies an accumulator function over a sequence.
Definition enumerable.hpp:59
bool any() const noexcept
Determines whether a sequence contains any elements.
Definition enumerable.hpp:125
accumulate_t aggregate(const accumulate_t &seed, const std::function< accumulate_t(const source_t &, const accumulate_t &)> &func) const
Applies an accumulator function over a sequence. The specified seed value is used as the initial accu...
Definition enumerable.hpp:81
source_t first_or_default(const source_t default_value) const noexcept
Returns the first element of the sequence that satisfies a condition or a default value if no such el...
Definition enumerable.hpp:278
source_t first_or_default(const std::function< bool(const source_t &)> &predicate) const noexcept
Returns the first element of the sequence that satisfies a condition or a default value if no such el...
Definition enumerable.hpp:271
const ienumerable< source_t > & 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:250
typename xtd::linq::enumerable::list< type_t > list
Represents the list value type.
Definition enumerable.hpp:47
const ienumerable< source_t > & 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:355
source_t 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
Applies an accumulator function over a sequence. The specified seed value is used as the initial accu...
Definition enumerable.hpp:92
auto average() const noexcept
Computes the average of a sequence of source_t values.
Definition enumerable.hpp:160
const ienumerable< source_t > & select(const std::function< source_t(const source_t &)> &selector) const
Projects each element of a sequence into a new form.
Definition enumerable.hpp:307
const ienumerable< source_t > & 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:257
const ienumerable< source_t > & where(const std::function< bool(const source_t &)> &predicate) const
Filters a sequence of values based on a predicate.
Definition enumerable.hpp:346
const ienumerable< result_t > & select(const std::function< result_t(const source_t &)> &selector) const
Projects each element of a sequence into a new form.
Definition enumerable.hpp:297
const list< source_t > & to_list() const noexcept
Creates a xtd::collections::generic::list <type_t> from an xtd::collections::generic::ienumerable <ty...
source_t source_type
Represents the ienumerable source type.
Definition enumerable.hpp:40
const ienumerable< result_t > & 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:319
bool any(const std::function< bool(const source_t &)> &predicate) const
Determines whether any element of a sequence satisfies a condition.
Definition enumerable.hpp:134
bool contains(const source_t &value, const xtd::collections::generic::iequality_comparer< source_t > &comparer) const noexcept
Determines whether a sequence contains a specified element by using a specified equality comparer.
Definition enumerable.hpp:200
bool all(const std::function< bool(const source_t &)> &predicate) const
Determines whether all elements of a sequence satisfy a condition.
Definition enumerable.hpp:116
const ienumerable< xtd::array< source_t > > & chunk(size_t size) const
Splits the elements of a sequence into chunks of size at most size.
Definition enumerable.hpp:178
source_t first_or_default() const noexcept
Returns the first element of the sequence that satisfies a condition or a default value if no such el...
Definition enumerable.hpp:284
const ienumerable< result_t > & cast() const noexcept
Casts the elements of an xtd::collections::generic::ienumerable to the specified type.
Definition enumerable.hpp:169
const ienumerable< key_value_pair< key_t, xtd::size > > & 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:244
const ienumerable< source_t > & concat(const ienumerable< source_t > &second) const noexcept
Concatenates two sequences.
Definition enumerable.hpp:185
bool contains(const source_t &value) const noexcept
Determines whether a sequence contains a specified element by using the default equality comparer.
Definition enumerable.hpp:192
typename xtd::linq::enumerable::ienumerable< type_t > ienumerable
Represents the ienumerable value type.
Definition enumerable.hpp:43
size_t count(const std::function< bool(const source_t &)> &predicate) const noexcept
Returns a number that represents how many elements in the specified sequence satisfy a condition.
Definition enumerable.hpp:219
source_t aggregate(const source_t &seed, const std::function< source_t(const source_t &, const source_t &)> &func) const
Applies an accumulator function over a sequence. The specified seed value is used as the initial accu...
Definition enumerable.hpp:69
enumerable_t enumerable_type
Represents the ienumerable enumerable type.
Definition enumerable.hpp:38
source_t first_or_default(const std::function< bool(const source_t &)> &predicate, const source_t &default_value) const noexcept
Returns the first element of the sequence that satisfies a condition, or a specified default value if...
Definition enumerable.hpp:265
Defines methods to support the comparison of objects for equality.
Definition iequality_comparer.hpp:34
static xtd::decimal average(const ienumerable< xtd::decimal > &source)
Computes the average of a sequence of xtd::decimal values.
static const ienumerable< xtd::array< source_t > > & chunk(const ienumerable< source_t > &source, xtd::size size)
Splits the elements of a sequence into chunks of size at most size.
static const ienumerable< result_t > & 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:660
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:176
typename xtd::collections::generic::ienumerable< type_t > ienumerable
Represents the ienumerable value type.
Definition enumerable.hpp:66
static const ienumerable< source_t > & 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:739
static bool any(const ienumerable< source_t > &source) noexcept
Determines whether a sequence contains any elements.
Definition enumerable.hpp:191
typename xtd::collections::generic::list< type_t > list
Represents the list value type.
Definition enumerable.hpp:70
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:399
static const ienumerable< source_t > & as_enumerable(const ienumerable< source_t > &source) noexcept
Returns the input typed as xtd::collections::generic::ienumerable <type_t>.
Definition enumerable.hpp:235
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:531
static const ienumerable< source_t > & 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:502
static const ienumerable< source_t > & append(const ienumerable< source_t > &source, const source_t &element) noexcept
Appends a value to the end of the sequence.
Definition enumerable.hpp:218
static const ienumerable< source_t > & concat(const ienumerable< source_t > &first, const ienumerable< source_t > &second) noexcept
Concatenates two sequences.
Definition enumerable.hpp:383
static xtd::size count(const ienumerable< source_t > &source) noexcept
Returns the number of elements in a sequence.
Definition enumerable.hpp:426
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:89
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
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10