xtd 1.0.0
Loading...
Searching...
No Matches
enumerable_.hpp
Go to the documentation of this file.
1
4#pragma once
10#define __XTD_STD_INTERNAL__
12#undef __XTD_STD_INTERNAL__
13#define __XTD_CORE_INTERNAL__
17#undef __XTD_CORE_INTERNAL__
18#include "../callable.hpp"
19#include "../decimal.hpp"
20#include "../integer.hpp"
21#include "../iterable.hpp"
23#include "../func_callable.hpp"
24#include "../iequatable.hpp"
25#include "../int32.hpp"
26#include "../int64.hpp"
27#include "../numeric.hpp"
28#include "../optional.hpp"
30#include "../static.hpp"
31#include "../usize.hpp"
32#include <algorithm>
33#include <bitset>
34#include <functional>
35#include <queue>
36#include <stack>
37#include <tuple>
38#include <utility>
39
41template<typename type_t>
42struct __opaque_xtd_linq_enumerable_collection__;
43template<typename type_t, typename param_t>
44struct __opaque_xtd_linq_lazy_enumerable__;
46
48namespace xtd {
50 class range;
51 namespace collections::generic {
52 template<typename type_t>
54 template<typename type_t>
55 class ienumerable;
56 }
58
60 namespace linq {
61
78 public:
80
83 template<typename type_t>
85
87 template<typename type_t>
89
91 template<typename type_t>
93
95 template<typename type_t>
97
99 template<typename key_t, typename value_t>
102
104
114 template<xtd::iterable source_t, xtd::func_callable<xtd::iterable_value_type<source_t>, xtd::iterable_value_type<source_t>, xtd::iterable_value_type<source_t>> func_t>
115 [[nodiscard]] static auto aggregate(source_t&& source, func_t&& func) -> xtd::iterable_value_type<source_t>;
126 template<xtd::iterable source_t, xtd::func_callable<xtd::iterable_value_type<source_t>, xtd::iterable_value_type<source_t>, xtd::iterable_value_type<source_t>> func_t>
127 [[nodiscard]] static auto aggregate(source_t&& source, xtd::iterable_value_type<source_t>&& seed, func_t&& func) -> xtd::iterable_value_type<source_t>;
140 template<xtd::iterable source_t, xtd::func_callable<xtd::iterable_value_type<source_t>, xtd::iterable_value_type<source_t>, xtd::iterable_value_type<source_t>> func_t>
141 [[nodiscard]] static auto aggregate(source_t&& source, xtd::iterable_value_type<source_t>&& seed, func_t&& func, auto&& result_selector) -> xtd::raw_type<decltype(result_selector(std::declval<const xtd::iterable_value_type<source_t>&>()))>;
142
151 template<xtd::iterable source_t, xtd::predicate_callable<xtd::iterable_value_type<source_t>> predicate_t>
152 [[nodiscard]] static auto all(source_t&& source, predicate_t&& predicate) -> bool;
153
162 template<xtd::iterable source_t>
163 [[nodiscard]] static auto any(source_t&& source) noexcept -> bool;
172 template<xtd::iterable source_t, xtd::predicate_callable<xtd::iterable_value_type<source_t>> predicate_t>
173 [[nodiscard]] static auto any(source_t&& source, predicate_t&& predicate) -> bool;
174
183 template<xtd::iterable source_t>
185
194 template<xtd::iterable source_t>
195 [[nodiscard]] static auto as_enumerable(source_t&& source) noexcept; // Defined in include/xtd/collections/generic/list.hpp
203 template<xtd::iterable source_t>
204 [[nodiscard]] static auto as_enumerable(const source_t& source) noexcept -> xtd::collections::generic::enumerable_generator<xtd::iterable_value_type<source_t>>;
212 template<xtd::iterable source_t>
221 template<typename value_t>
222 [[nodiscard]] static auto as_enumerable(std::initializer_list<value_t> source) noexcept -> xtd::collections::generic::enumerable_generator<value_t>;
231 template<std::forward_iterator iterator_t>
232 [[nodiscard]] static auto as_enumerable(iterator_t first, iterator_t last) noexcept -> xtd::collections::generic::enumerable_generator<typename std::decay<decltype(*first)>::type>;
241 template<std::forward_iterator iterator_t>
242 [[nodiscard]] static auto as_enumerable(iterator_t iterator, xtd::usize length) noexcept -> xtd::collections::generic::enumerable_generator<typename std::decay<decltype(*iterator)>::type>;
251 template<typename value_t, xtd::usize length>
252 [[nodiscard]] static auto as_enumerable(const value_t (&array)[length]) noexcept -> xtd::collections::generic::enumerable_generator<value_t>;
261 template<typename value_t, xtd::usize length>
262 [[nodiscard]] static auto as_enumerable(value_t (&array)[length]) noexcept -> xtd::collections::generic::enumerable_generator<value_t>;
263
265 template<xtd::usize size_>
266 [[nodiscard]] static auto as_enumerable(const std::bitset<size_>& source) noexcept -> xtd::collections::generic::enumerable_generator<bool>; // defined in xtd/collections/bit_array.hpp
267 template<xtd::usize size_>
268 [[nodiscard]] static auto as_enumerable(std::bitset<size_>& source) noexcept -> xtd::collections::generic::enumerable_generator<bool>; // defined in xtd/collections/bit_array.hpp
269 template<typename value_t, typename container_t>
270 [[nodiscard]] static auto as_enumerable(const std::queue<value_t, container_t>& source) noexcept -> xtd::collections::generic::enumerable_generator<value_t>;
271 template<typename value_t, typename container_t>
272 [[nodiscard]] static auto as_enumerable(std::queue<value_t, container_t>& source) noexcept -> xtd::collections::generic::enumerable_generator<value_t>;
273 template<typename value_t, typename container_t>
274 [[nodiscard]] static auto as_enumerable(const std::priority_queue<value_t, container_t>& source) noexcept -> xtd::collections::generic::enumerable_generator<value_t>;
275 template<typename value_t, typename container_t>
276 [[nodiscard]] static auto as_enumerable(std::priority_queue<value_t, container_t>& source) noexcept -> xtd::collections::generic::enumerable_generator<value_t>;
277 template<typename value_t, typename container_t>
278 [[nodiscard]] static auto as_enumerable(const std::stack<value_t, container_t>& source) noexcept -> xtd::collections::generic::enumerable_generator<value_t>;
279 template<typename value_t, typename container_t>
280 [[nodiscard]] static auto as_enumerable(std::stack<value_t, container_t>& source) noexcept -> xtd::collections::generic::enumerable_generator<value_t>;
282
287 template<xtd::iterable source_t>
289 [[nodiscard]] static auto average(source_t&& source) -> xtd::decimal;
294 template<xtd::iterable source_t>
296 [[nodiscard]] static auto average(source_t&& source) -> double;
301 template<xtd::iterable source_t>
303 [[nodiscard]] static auto average(source_t&& source) -> xtd::single;
308 template<xtd::iterable source_t>
310 [[nodiscard]] static auto average(source_t&& source) -> double;
315 template<xtd::iterable source_t>
317 [[nodiscard]] static auto average(source_t&& source) -> double;
318
322 template<xtd::iterable source_t>
323 requires std::same_as<xtd::iterable_value_type<source_t>, xtd::optional<xtd::decimal>>
324 [[nodiscard]] static auto average(source_t&& source) -> xtd::optional<xtd::decimal>;
328 template<xtd::iterable source_t>
329 requires std::same_as<xtd::iterable_value_type<source_t>, xtd::optional<double>>
330 [[nodiscard]] static auto average(source_t&& source) -> xtd::optional<double>;
334 template<xtd::iterable source_t>
335 requires std::same_as<xtd::iterable_value_type<source_t>, xtd::optional<xtd::single>>
336 [[nodiscard]] static auto average(source_t&& source) -> xtd::optional<xtd::single>;
340 template<xtd::iterable source_t>
341 requires std::same_as<xtd::iterable_value_type<source_t>, xtd::optional<xtd::int32>>
342 [[nodiscard]] static auto average(source_t&& source) -> xtd::optional<double>;
346 template<xtd::iterable source_t>
347 requires std::same_as<xtd::iterable_value_type<source_t>, xtd::optional<xtd::int64>>
348 [[nodiscard]] static auto average(source_t&& source) -> xtd::optional<double>;
349
357 template<typename result_t, xtd::iterable source_t>
358 [[nodiscard]] static auto cast(source_t&& source) -> xtd::collections::generic::enumerable_generator<result_t>; // Defined include/xtd/as.hpp
359
367 template<xtd::iterable source_t>
368 [[nodiscard]] static auto chunk(source_t&& source, xtd::usize size) -> xtd::collections::generic::enumerable_generator<xtd::array<xtd::iterable_value_type<source_t>>>; // Defined in include/xtd/array.hpp
369
375 template<xtd::iterable first_t, xtd::iterable second_t>
376 [[nodiscard]] static auto concat(first_t&& first, second_t&& second) noexcept -> xtd::collections::generic::enumerable_generator<xtd::iterable_value_type<first_t>>;
377
383 template<xtd::iterable source_t>
384 [[nodiscard]] static auto contains(source_t&& source, const xtd::iterable_value_type<source_t>& value) noexcept -> bool;
391 template<xtd::iterable source_t>
392 [[nodiscard]] static auto contains(source_t&& source, const xtd::iterable_value_type<source_t>& value, const iequality_comparer<xtd::iterable_value_type<source_t>>& comparer) noexcept -> bool;
399 template<xtd::iterable source_t, xtd::func_callable<bool, xtd::iterable_value_type<source_t>, xtd::iterable_value_type<source_t>> equater_t>
400 [[nodiscard]] static auto contains(source_t&& source, const xtd::iterable_value_type<source_t>& value, equater_t&& equater) noexcept -> bool;
401
409 template<xtd::iterable source_t>
410 [[nodiscard]] static auto count(source_t&& source) noexcept -> xtd::usize;
419 template<xtd::iterable source_t, xtd::predicate_callable<xtd::iterable_value_type<source_t>> predicate_t>
420 [[nodiscard]] static auto count(source_t&& source, predicate_t&& predicate) noexcept -> xtd::usize;
426 template<xtd::iterable source_t>
427 [[nodiscard]] static auto count(source_t&& source, xtd::iterable_value_type<source_t>&& value) noexcept -> xtd::usize;
428
438 template<typename key_t, xtd::iterable source_t, xtd::callable<key_t, xtd::iterable_value_type<source_t>> key_selector_t>
439 [[nodiscard]] static auto count_by(source_t&& source, key_selector_t&& key_selector) noexcept -> xtd::collections::generic::enumerable_generator<xtd::collections::generic::key_value_pair<key_t, xtd::usize>>;
450 template<typename key_t, xtd::iterable source_t, xtd::callable<key_t, xtd::iterable_value_type<source_t>> key_selector_t>
451 [[nodiscard]] static auto count_by(source_t&& source, key_selector_t&& key_selector, const iequality_comparer<key_t>& key_comparer) noexcept -> xtd::collections::generic::enumerable_generator<xtd::collections::generic::key_value_pair<key_t, xtd::usize>>;
463 template<typename key_t, xtd::iterable source_t, xtd::callable<key_t, xtd::iterable_value_type<source_t>> key_selector_t, xtd::func_callable<bool, key_t, key_t> key_equater_t>
464 [[nodiscard]] static auto count_by(source_t&& source, key_selector_t&& key_selector, key_equater_t&& key_equater) noexcept -> xtd::collections::generic::enumerable_generator<xtd::collections::generic::key_value_pair<key_t, xtd::usize>>; // Defined in include/xtd/collections/generic/list.hpp
465
473 template<xtd::iterable source_t>
483 template<xtd::iterable source_t>
485
490 template<xtd::iterable source_t>
491 [[nodiscard]] static auto distinct(source_t&& source) noexcept -> xtd::collections::generic::enumerable_generator<xtd::iterable_value_type<source_t>>; // Defined in include/xtd/collections/generic/list.hpp
496 template<xtd::iterable source_t>
503 template<xtd::iterable source_t, xtd::func_callable<bool, xtd::iterable_value_type<source_t>, xtd::iterable_value_type<source_t>> equater_t>
504 [[nodiscard]] static auto distinct(source_t&& source, equater_t&& equater) noexcept -> xtd::collections::generic::enumerable_generator<xtd::iterable_value_type<source_t>>; // Defined in include/xtd/collections/generic/list.hpp
505
511 template<xtd::iterable source_t>
512 [[nodiscard]] static auto first(source_t&& source) -> xtd::iterable_value_type<source_t>;
519 template<xtd::iterable source_t, xtd::func_callable<bool, xtd::iterable_value_type<source_t>> predicate_t>
520 [[nodiscard]] static auto first(source_t&& source, predicate_t&& predicate) -> xtd::iterable_value_type<source_t>;
521
528 template<xtd::iterable source_t, xtd::predicate_callable<xtd::iterable_value_type<source_t>> prediacte_t>
529 [[nodiscard]] static auto first_or_default(source_t&& source, prediacte_t&& predicate, xtd::iterable_value_type<source_t>&& default_value) noexcept -> xtd::iterable_value_type<source_t>;
535 template<xtd::iterable source_t, xtd::predicate_callable<xtd::iterable_value_type<source_t>> prediacte_t>
536 [[nodiscard]] static auto first_or_default(source_t&& source, prediacte_t&& predicate) noexcept -> xtd::iterable_value_type<source_t>;
542 template<xtd::iterable source_t>
543 [[nodiscard]] static auto first_or_default(source_t&& source, xtd::iterable_value_type<source_t>&& default_value) noexcept -> xtd::iterable_value_type<source_t>;
548 template<xtd::iterable source_t>
549 [[nodiscard]] static auto first_or_default(source_t&& source) noexcept -> xtd::iterable_value_type<source_t>;
550
560 template<xtd::iterable source_t>
561 [[nodiscard]] static auto from(source_t&& source) noexcept; // Defined in include/xtd/collections/generic/list.hpp
570 template<xtd::iterable source_t>
571 [[nodiscard]] static auto from(const source_t& source) noexcept -> xtd::collections::generic::enumerable_generator<xtd::iterable_value_type<source_t>>;
580 template<xtd::iterable source_t>
581 [[nodiscard]] static auto from(source_t& source) noexcept -> xtd::collections::generic::enumerable_generator<xtd::iterable_value_type<source_t>>;
590 template<typename value_t>
591 [[nodiscard]] static auto from(std::initializer_list<value_t> source) noexcept -> xtd::collections::generic::enumerable_generator<value_t>;
603 template<std::forward_iterator iterator_t>
604 [[nodiscard]] static auto from(iterator_t first, iterator_t last) noexcept -> xtd::collections::generic::enumerable_generator<typename std::decay<decltype(*first)>::type>;
614 template<std::forward_iterator iterator_t>
615 [[nodiscard]] static auto from(iterator_t iterator, xtd::usize length) noexcept -> xtd::collections::generic::enumerable_generator<typename std::decay<decltype(*iterator)>::type>;
625 template<typename value_t, xtd::usize length>
626 [[nodiscard]] static auto from(const value_t (&array)[length]) noexcept -> xtd::collections::generic::enumerable_generator<value_t>;
636 template<typename value_t, xtd::usize length>
637 [[nodiscard]] static auto from(value_t (&array)[length]) noexcept -> xtd::collections::generic::enumerable_generator<value_t>;
638
640 template<xtd::usize size_>
641 [[nodiscard]] static auto from(const std::bitset<size_>& source) noexcept -> xtd::collections::generic::enumerable_generator<bool>; // defined in xtd/collections/bit_array.hpp
642 template<xtd::usize size_>
643 [[nodiscard]] static auto from(std::bitset<size_>& source) noexcept -> xtd::collections::generic::enumerable_generator<bool>; // defined in xtd/collections/bit_array.hpp
644 template<typename value_t, typename container_t>
645 [[nodiscard]] static auto from(const std::queue<value_t, container_t>& source) noexcept -> xtd::collections::generic::enumerable_generator<value_t>;
646 template<typename value_t, typename container_t>
647 [[nodiscard]] static auto from(std::queue<value_t, container_t>& source) noexcept -> xtd::collections::generic::enumerable_generator<value_t>;
648 template<typename value_t, typename container_t>
649 [[nodiscard]] static auto from(const std::priority_queue<value_t, container_t>& source) noexcept -> xtd::collections::generic::enumerable_generator<value_t>;
650 template<typename value_t, typename container_t>
651 [[nodiscard]] static auto from(std::priority_queue<value_t, container_t>& source) noexcept -> xtd::collections::generic::enumerable_generator<value_t>;
652 template<typename value_t, typename container_t>
653 [[nodiscard]] static auto from(const std::stack<value_t, container_t>& source) noexcept -> xtd::collections::generic::enumerable_generator<value_t>;
654 template<typename value_t, typename container_t>
655 [[nodiscard]] static auto from(std::stack<value_t, container_t>& source) noexcept -> xtd::collections::generic::enumerable_generator<value_t>;
657
663 template<xtd::iterable source_t>
664 [[nodiscard]] static auto last(source_t&& source) -> xtd::iterable_value_type<source_t>;
671 template<xtd::iterable source_t, xtd::func_callable<bool, xtd::iterable_value_type<source_t>> predicate_t>
672 [[nodiscard]] static auto last(source_t&& source, predicate_t&& predicate) -> xtd::iterable_value_type<source_t>;
673
677 template<xtd::iterable source_t>
679 [[nodiscard]] static auto max(source_t&& source) -> xtd::iterable_value_type<source_t>;
684 template<xtd::iterable source_t, xtd::callable<xtd::iterable_value_type<source_t>, xtd::iterable_value_type<source_t>> selector_t>
686 [[nodiscard]] static auto max(source_t&& source, selector_t&& selector) -> xtd::iterable_value_type<source_t>;
691 template<typename result_t, xtd::iterable source_t, xtd::callable<result_t, xtd::iterable_value_type<source_t>> selector_t>
693 [[nodiscard]] static auto max(source_t&& source, selector_t&& selector) -> result_t;
694
698 template<xtd::iterable source_t>
700 [[nodiscard]] static auto min(source_t&& source) -> xtd::iterable_value_type<source_t>;
705 template<xtd::iterable source_t, xtd::callable<xtd::iterable_value_type<source_t>, xtd::iterable_value_type<source_t>> selector_t>
707 [[nodiscard]] static auto min(source_t&& source, selector_t&& selector) -> xtd::iterable_value_type<source_t>;
712 template<typename result_t, xtd::iterable source_t, xtd::callable<result_t, xtd::iterable_value_type<source_t>> selector_t>
714 [[nodiscard]] static auto min(source_t&& source, selector_t&& selector) -> result_t;
715
719 template<xtd::iterable source_t>
725 template<xtd::iterable source_t>
732 template<xtd::iterable source_t, xtd::func_callable<bool, xtd::iterable_value_type<source_t>, xtd::iterable_value_type<source_t>> lesser_t>
733 [[nodiscard]] static auto order(source_t&& source, lesser_t&& lesser) -> xtd::collections::generic::enumerable_generator<xtd::iterable_value_type<source_t>>; // Defined in include/xtd/collections/generic/list.hpp
734
742 template<typename key_t, xtd::iterable source_t, xtd::callable<key_t, xtd::iterable_value_type<source_t>> key_selector_t>
743 [[nodiscard]] static auto order_by(source_t&& source, key_selector_t&& key_selector) -> xtd::collections::generic::enumerable_generator<xtd::iterable_value_type<source_t>>; // Defined in include/xtd/collections/generic/list.hpp
744
752 template<xtd::iterable source_t, xtd::callable<xtd::iterable_value_type<source_t>, xtd::iterable_value_type<source_t>> key_selector_t>
753 [[nodiscard]] static auto order_by(source_t&& source, key_selector_t&& key_selector) -> xtd::collections::generic::enumerable_generator<xtd::iterable_value_type<source_t>>; // Defined in include/xtd/collections/generic/list.hpp
754
762 template<typename key_t, xtd::iterable source_t, xtd::callable<key_t, xtd::iterable_value_type<source_t>> key_selector_t>
763 [[nodiscard]] static auto order_by_descending(source_t&& source, key_selector_t&& key_selector) -> xtd::collections::generic::enumerable_generator<xtd::iterable_value_type<source_t>>; // Defined in include/xtd/collections/generic/list.hpp
764
772 template<xtd::iterable source_t, xtd::callable<xtd::iterable_value_type<source_t>, xtd::iterable_value_type<source_t>> key_selector_t>
773 [[nodiscard]] static auto order_by_descending(source_t&& source, key_selector_t&& key_selector) -> xtd::collections::generic::enumerable_generator<xtd::iterable_value_type<source_t>>; // Defined in include/xtd/collections/generic/list.hpp
774
782 template<xtd::integer integer_t>
792 template<xtd::integer integer_t>
793 [[nodiscard]] static auto range(integer_t start, integer_t count) -> xtd::collections::generic::enumerable_generator<integer_t>;
800 template<xtd::integer integer_t>
801 [[nodiscard]] static auto range(integer_t start, integer_t count, integer_t step) -> xtd::collections::generic::enumerable_generator<integer_t>;
802
810 template<typename element_t>
811 [[nodiscard]] static auto repeat(const element_t& element, xtd::usize count) -> xtd::collections::generic::enumerable_generator<element_t>;
812
814 [[nodiscard]] static auto repeat(const char* element, xtd::usize count) -> xtd::collections::generic::enumerable_generator<string>; // Defined in include/xtd/string.hpp
815 [[nodiscard]] static auto repeat(const xtd::char16* element, xtd::usize count) -> xtd::collections::generic::enumerable_generator<string>; // Defined in include/xtd/string.hpp
816 [[nodiscard]] static auto repeat(const xtd::char32* element, xtd::usize count) -> xtd::collections::generic::enumerable_generator<string>; // Defined in include/xtd/string.hpp
817 [[nodiscard]] static auto repeat(const xtd::char8* element, xtd::usize count) -> xtd::collections::generic::enumerable_generator<string>; // Defined in include/xtd/string.hpp
818 [[nodiscard]] static auto repeat(const xtd::wchar* element, xtd::usize count) -> xtd::collections::generic::enumerable_generator<string>; // Defined in include/xtd/string.hpp
820
825 template<xtd::iterable source_t>
827
837 template<xtd::iterable source_t>
838 [[nodiscard]] static auto select(source_t&& source, auto&& selector) -> xtd::collections::generic::enumerable_generator<xtd::raw_type<decltype(selector(std::declval<const xtd::iterable_value_type<source_t>&>()))>>;
839 /*
849 template<xtd::iterable source_t>
850 [[nodiscard]] static auto select(source_t&& source, auto&& selector) -> xtd::collections::generic::enumerable_generator<xtd::raw_type<decltype(selector(std::declval<const xtd::iterable_value_type<source_t>&>(), xtd::usize {}))>>;
851 */
852
857 template<xtd::iterable first_t, xtd::iterable second_t>
858 [[nodiscard]] static auto sequence_equal(first_t&& first, second_t&& second) -> bool;
864 template<xtd::iterable first_t, xtd::iterable second_t>
865 [[nodiscard]] static auto sequence_equal(first_t&& first, second_t&& second, const iequality_comparer<xtd::iterable_value_type<first_t>>& comparer) -> bool;
871 template<xtd::iterable first_t, xtd::iterable second_t, xtd::func_callable<bool, xtd::iterable_value_type<first_t>, xtd::iterable_value_type<second_t>> equality_comparer_t>
872 [[nodiscard]] static auto sequence_equal(first_t&& first, second_t&& second, equality_comparer_t&& comparer) -> bool;
873
878 template<xtd::forward_iterable source_t>
879 [[nodiscard]] static auto shuffle(source_t&& source) -> xtd::collections::generic::enumerable_generator<xtd::iterable_value_type<source_t>>; // Defined in include/xtd/random.hpp
880
885 template<xtd::iterable source_t>
887
895 template<xtd::iterable source_t>
897
902 template<xtd::iterable source_t>
909 template<xtd::iterable source_t>
910 [[nodiscard]] static auto take(source_t&& source, const xtd::range& range) -> xtd::collections::generic::enumerable_generator<xtd::iterable_value_type<source_t>>; // Defined in include/xtd/range.hpp
911
919 template<xtd::iterable source_t>
921
931 template<typename source_t>
932 [[nodiscard]] static auto to_array(const ienumerable<source_t>& source); // Defined in include/xtd/array.hpp
933
943 template<typename source_t>
944 [[nodiscard]] static auto to_list(const ienumerable<source_t>& source); // Defined in include/xtd/collections/generic/list.hpp
945
957 template<xtd::iterable source_t>
959
967 template<xtd::iterable first_t, xtd::iterable second_t>
977 template<xtd::iterable first_t, xtd::iterable second_t>
978 [[nodiscard]] static auto zip(first_t&& first, second_t&& second, auto&& result_selector) -> xtd::collections::generic::enumerable_generator<xtd::raw_type<decltype(result_selector(std::declval<const xtd::iterable_value_type<first_t>&>(), std::declval<const xtd::iterable_value_type<second_t>&>()))>>;
984 template<xtd::iterable first_t, xtd::iterable second_t, xtd::iterable third_t>
992 template<xtd::iterable first_t, xtd::iterable second_t, xtd::iterable third_t>
993 [[nodiscard]] static auto zip(first_t&& first, second_t&& second, third_t&& third, auto&& result_selector) -> xtd::collections::generic::enumerable_generator<xtd::raw_type<decltype(result_selector(std::declval<const xtd::iterable_value_type<first_t>&>(), std::declval<const xtd::iterable_value_type<second_t>&>(), std::declval<const xtd::iterable_value_type<third_t>&>()))>>;
995
996 private:
997 template<typename type_t>
998 struct enumerable_holder {
999 enumerable_holder(const type_t& value);
1000 //enumerable_holder(type_t& value);
1001 enumerable_holder(type_t&& value) requires std::movable<type_t>;
1002
1003 auto get() const -> const xtd::raw_type<type_t>&;
1004
1005 private:
1006 std::optional<type_t> value_;
1007 const xtd::raw_type<type_t>* ptr_;
1008 };
1009
1010 template<typename...>
1011 static inline constexpr bool always_false_v = false;
1012
1013 template<typename predicate_t, typename value_t>
1014 [[nodiscard]] static constexpr auto invoke_predicate_with_optional_index(predicate_t&& predicate, value_t&& value, xtd::usize index) -> bool;
1015
1016 template<typename result_t, typename selector_t, typename value_t>
1017 [[nodiscard]] static auto invoke_selector_with_optional_index(selector_t&& selector, value_t&& value, xtd::usize index) -> result_t;
1018 };
1019 }
1020}
Contains xtd::callable concept.
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:64
Represents an enumerable generator that supports deferred, lazy iteration over a collection of a spec...
Definition enumerable_generator.hpp:45
Exposes a method that compares two objects.
Definition icomparer.hpp:30
Exposes the enumerator, which supports a simple iteration over a collection of a specified type.
Definition ienumerable.hpp:46
Defines methods to support the comparison of objects for equality.
Definition iequality_comparer.hpp:34
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
Definition list.hpp:84
Provides a set of static methods for querying objects that implement ienumerable <type_t>.
Definition enumerable_.hpp:77
static auto chunk(source_t &&source, xtd::usize size) -> xtd::collections::generic::enumerable_generator< xtd::array< xtd::iterable_value_type< source_t > > >
Splits the elements of a sequence into chunks of size at most size.
static auto order_by_descending(source_t &&source, key_selector_t &&key_selector) -> xtd::collections::generic::enumerable_generator< xtd::iterable_value_type< source_t > >
Sorts the elements of a sequence in descending order according to a key.
static auto zip(first_t &&first, second_t &&second, third_t &&third, auto &&result_selector) -> xtd::collections::generic::enumerable_generator< xtd::raw_type< decltype(result_selector(std::declval< const xtd::iterable_value_type< first_t > & >(), std::declval< const xtd::iterable_value_type< second_t > & >(), std::declval< const xtd::iterable_value_type< third_t > & >()))> >
Applies a specified function to the corresponding elements of three sequences, producing a sequence o...
static auto last(source_t &&source) -> xtd::iterable_value_type< source_t >
Returns the last element of a sequence.
static auto order(source_t &&source, lesser_t &&lesser) -> xtd::collections::generic::enumerable_generator< xtd::iterable_value_type< source_t > >
Sorts the elements of a sequence in ascending order.
static auto range(integer_t start, integer_t count) -> xtd::collections::generic::enumerable_generator< integer_t >
Generates a sequence of integral numbers within a specified range.
static auto sequence_equal(first_t &&first, second_t &&second) -> bool
Determines whether two sequences are equal by comparing the elements by using the default equality co...
static auto zip(first_t &&first, second_t &&second) -> xtd::collections::generic::enumerable_generator< std::tuple< xtd::iterable_value_type< first_t >, xtd::iterable_value_type< second_t > > >
Produces a sequence of tuples with elements from the two specified sequences.
static auto order_by(source_t &&source, key_selector_t &&key_selector) -> xtd::collections::generic::enumerable_generator< xtd::iterable_value_type< source_t > >
Sorts the elements of a sequence in ascending order according to a key.
static auto last(source_t &&source, predicate_t &&predicate) -> xtd::iterable_value_type< source_t >
Returns the last element in a sequence that satisfies a specified condition.
static auto skip_while(source_t &&source, auto &&predicate) -> xtd::collections::generic::enumerable_generator< xtd::iterable_value_type< source_t > >
Bypasses elements in a sequence as long as a specified condition is true and then returns the remaini...
static auto order_by_descending(source_t &&source, key_selector_t &&key_selector) -> xtd::collections::generic::enumerable_generator< xtd::iterable_value_type< source_t > >
Sorts the elements of a sequence in descending order according to a key.
static auto max(source_t &&source, selector_t &&selector) -> xtd::iterable_value_type< source_t >
Returns the maximum value in a sequence of xtd::numeric values.
typename xtd::collections::generic::ienumerable< type_t > ienumerable
Represents the ienumerable value type.
Definition enumerable_.hpp:92
typename xtd::collections::generic::enumerator< type_t > enumerator
Represents the enumerator value type.
Definition enumerable_.hpp:84
static auto sequence_equal(first_t &&first, second_t &&second, const iequality_comparer< xtd::iterable_value_type< first_t > > &comparer) -> bool
Determines whether two sequences are equal by comparing their elements by using a specifie the equali...
static auto distinct(source_t &&source) noexcept -> xtd::collections::generic::enumerable_generator< xtd::iterable_value_type< source_t > >
Returns distinct elements from a sequence by using the default equality comparer to compare values.
static auto from(std::initializer_list< value_t > source) noexcept -> xtd::collections::generic::enumerable_generator< value_t >
Returns the input typed as xtd::collections::generic::ienumerable <type_t>.
static auto concat(first_t &&first, second_t &&second) noexcept -> xtd::collections::generic::enumerable_generator< xtd::iterable_value_type< first_t > >
Concatenates two sequences.
static auto first_or_default(source_t &&source, prediacte_t &&predicate, xtd::iterable_value_type< source_t > &&default_value) noexcept -> xtd::iterable_value_type< source_t >
Returns the first element of the sequence that satisfies a condition, or a specified default value if...
typename xtd::collections::generic::iequality_comparer< type_t > iequality_comparer
Represents the ienumerable value type.
Definition enumerable_.hpp:88
static auto aggregate(source_t &&source, xtd::iterable_value_type< source_t > &&seed, func_t &&func, auto &&result_selector) -> xtd::raw_type< decltype(result_selector(std::declval< const xtd::iterable_value_type< source_t > & >()))>
Applies an accumulator function over a sequence. The specified seed value is used as the initial accu...
static auto zip(first_t &&first, second_t &&second, third_t &&third) -> xtd::collections::generic::enumerable_generator< std::tuple< xtd::iterable_value_type< first_t >, xtd::iterable_value_type< second_t >, xtd::iterable_value_type< third_t > > >
Produces a sequence of tuples with elements from the three specified sequences.
static auto min(source_t &&source) -> xtd::iterable_value_type< source_t >
Returns the minimum value in a sequence of xtd::numeric values.
static auto count_by(source_t &&source, key_selector_t &&key_selector, const iequality_comparer< key_t > &key_comparer) noexcept -> xtd::collections::generic::enumerable_generator< xtd::collections::generic::key_value_pair< key_t, xtd::usize > >
Returns the count of elements in the source sequence grouped by key.
static auto as_enumerable(iterator_t first, iterator_t last) noexcept -> xtd::collections::generic::enumerable_generator< typename std::decay< decltype(*first)>::type >
Returns the input typed as xtd::collections::generic::ienumerable <type_t>.
typename xtd::collections::generic::list< type_t > list
Represents the list value type.
Definition enumerable_.hpp:96
static auto as_enumerable(value_t(&array)[length]) noexcept -> xtd::collections::generic::enumerable_generator< value_t >
Returns the input typed as xtd::collections::generic::ienumerable <type_t>.
static auto default_if_empty(source_t &&source) noexcept -> xtd::collections::generic::enumerable_generator< xtd::iterable_value_type< source_t > >
Returns the elements of the specified sequence or the type parameter's default value in a singleton c...
static auto contains(source_t &&source, const xtd::iterable_value_type< source_t > &value) noexcept -> bool
Determines whether a sequence contains a specified element by using the default equality comparer.
static auto as_enumerable(const value_t(&array)[length]) noexcept -> xtd::collections::generic::enumerable_generator< value_t >
Returns the input typed as xtd::collections::generic::ienumerable <type_t>.
static auto first(source_t &&source, predicate_t &&predicate) -> xtd::iterable_value_type< source_t >
Returns the first element in a sequence that satisfies a specified condition.
static auto take(source_t &&source, xtd::usize count) -> xtd::collections::generic::enumerable_generator< xtd::iterable_value_type< source_t > >
Returns a specified number of contiguous elements from the start of a sequence.
static auto average(source_t &&source) -> double
Computes the average of a sequence of xtd::int64 values.
static auto average(source_t &&source) -> xtd::optional< double >
Computes the average of a sequence of optional xtd::int64 values.
static auto as_enumerable(const source_t &source) noexcept -> xtd::collections::generic::enumerable_generator< xtd::iterable_value_type< source_t > >
Returns the input typed as xtd::collections::generic::ienumerable <type_t>.
static auto average(source_t &&source) -> xtd::optional< double >
Computes the average of a sequence of optional double values.
static auto count_by(source_t &&source, key_selector_t &&key_selector) noexcept -> xtd::collections::generic::enumerable_generator< xtd::collections::generic::key_value_pair< key_t, xtd::usize > >
Returns the count of elements in the source sequence grouped by key.
static auto first_or_default(source_t &&source, xtd::iterable_value_type< source_t > &&default_value) noexcept -> xtd::iterable_value_type< source_t >
Returns the first element of the sequence that satisfies a condition or a default value if no such el...
static auto from(iterator_t iterator, xtd::usize length) noexcept -> xtd::collections::generic::enumerable_generator< typename std::decay< decltype(*iterator)>::type >
Returns the input typed as xtd::collections::generic::ienumerable <type_t>.
static auto all(source_t &&source, predicate_t &&predicate) -> bool
Determines whether all elements of a sequence satisfy a condition.
static auto average(source_t &&source) -> xtd::optional< xtd::decimal >
Computes the average of a sequence of optional xtd::decimal values.
static auto as_enumerable(iterator_t iterator, xtd::usize length) noexcept -> xtd::collections::generic::enumerable_generator< typename std::decay< decltype(*iterator)>::type >
Returns the input typed as xtd::collections::generic::ienumerable <type_t>.
static auto zip(first_t &&first, second_t &&second, auto &&result_selector) -> xtd::collections::generic::enumerable_generator< xtd::raw_type< decltype(result_selector(std::declval< const xtd::iterable_value_type< first_t > & >(), std::declval< const xtd::iterable_value_type< second_t > & >()))> >
Applies a specified function to the corresponding elements of two sequences, producing a sequence of ...
static auto distinct(source_t &&source, equater_t &&equater) noexcept -> xtd::collections::generic::enumerable_generator< xtd::iterable_value_type< source_t > >
Returns distinct elements from a sequence by using a specified xtd::collections::generic::iequality_c...
static auto average(source_t &&source) -> xtd::optional< xtd::single >
Computes the average of a sequence of optional float values.
static auto order(source_t &&source, const xtd::collections::generic::icomparer< xtd::iterable_value_type< source_t > > &comparer) -> xtd::collections::generic::enumerable_generator< xtd::iterable_value_type< source_t > >
Sorts the elements of a sequence in ascending order.
static auto from(source_t &&source) noexcept
Returns the input typed as xtd::collections::generic::ienumerable <type_t>.
static auto max(source_t &&source, selector_t &&selector) -> result_t
Returns the maximum value in a sequence of xtd::numeric values.
static auto shuffle(source_t &&source) -> xtd::collections::generic::enumerable_generator< xtd::iterable_value_type< source_t > >
Shuffles the order of the elements of a sequence.
Definition random.hpp:277
static auto contains(source_t &&source, const xtd::iterable_value_type< source_t > &value, equater_t &&equater) noexcept -> bool
Determines whether a sequence contains a specified element by using a specified equality comparer.
static auto order(source_t &&source) -> xtd::collections::generic::enumerable_generator< xtd::iterable_value_type< source_t > >
Sorts the elements of a sequence in ascending order.
static auto cast(source_t &&source) -> xtd::collections::generic::enumerable_generator< result_t >
Casts the elements of an xtd::collections::generic::ienumerable to the specified type.
static auto where(source_t &&source, auto &&predicate) -> xtd::collections::generic::enumerable_generator< xtd::iterable_value_type< source_t > >
Filters a sequence of values based on a predicate.
static auto aggregate(source_t &&source, func_t &&func) -> xtd::iterable_value_type< source_t >
Applies an accumulator function over a sequence.
static auto first_or_default(source_t &&source, prediacte_t &&predicate) noexcept -> xtd::iterable_value_type< source_t >
Returns the first element of the sequence that satisfies a condition or a default value if no such el...
static auto from(iterator_t first, iterator_t last) noexcept -> xtd::collections::generic::enumerable_generator< typename std::decay< decltype(*first)>::type >
Returns the input typed as xtd::collections::generic::ienumerable <type_t>.
static auto as_enumerable(source_t &&source) noexcept
Returns the input typed as xtd::collections::generic::ienumerable <type_t>.
static auto average(source_t &&source) -> xtd::decimal
Computes the average of a sequence of xtd::decimal values.
static auto distinct(source_t &&source, const iequality_comparer< xtd::iterable_value_type< source_t > > &comparer) noexcept -> xtd::collections::generic::enumerable_generator< xtd::iterable_value_type< source_t > >
Returns distinct elements from a sequence by using a specified xtd::collections::generic::iequality_c...
static auto as_enumerable(source_t &source) noexcept -> xtd::collections::generic::enumerable_generator< xtd::iterable_value_type< source_t > >
Returns the input typed as xtd::collections::generic::ienumerable <type_t>.
static auto any(source_t &&source, predicate_t &&predicate) -> bool
Determines whether any element of a sequence satisfies a condition.
static auto from(const value_t(&array)[length]) noexcept -> xtd::collections::generic::enumerable_generator< value_t >
Returns the input typed as xtd::collections::generic::ienumerable <type_t>.
static auto min(source_t &&source, selector_t &&selector) -> xtd::iterable_value_type< source_t >
Returns the minimum value in a sequence of xtd::numeric values.
static auto from(value_t(&array)[length]) noexcept -> xtd::collections::generic::enumerable_generator< value_t >
Returns the input typed as xtd::collections::generic::ienumerable <type_t>.
static auto select(source_t &&source, auto &&selector) -> xtd::collections::generic::enumerable_generator< xtd::raw_type< decltype(selector(std::declval< const xtd::iterable_value_type< source_t > & >()))> >
Projects each element of a sequence into a new form.
static auto count(source_t &&source, predicate_t &&predicate) noexcept -> xtd::usize
Returns a number that represents how many elements in the specified sequence satisfy a condition.
static auto from(const source_t &source) noexcept -> xtd::collections::generic::enumerable_generator< xtd::iterable_value_type< source_t > >
Returns the input typed as xtd::collections::generic::ienumerable <type_t>.
static auto contains(source_t &&source, const xtd::iterable_value_type< source_t > &value, const iequality_comparer< xtd::iterable_value_type< source_t > > &comparer) noexcept -> bool
Determines whether a sequence contains a specified element by using a specified equality comparer.
static auto average(source_t &&source) -> double
Computes the average of a sequence of double values.
static auto to_array(const ienumerable< source_t > &source)
Creates a xtd::array <type_t> from an xtd::collections::generic::ienumerable <type_t>.
static auto aggregate(source_t &&source, xtd::iterable_value_type< source_t > &&seed, func_t &&func) -> xtd::iterable_value_type< source_t >
Applies an accumulator function over a sequence. The specified seed value is used as the initial accu...
static auto append(source_t &&source, xtd::iterable_value_type< source_t > &&element) noexcept -> xtd::collections::generic::enumerable_generator< xtd::iterable_value_type< source_t > >
Appends a value to the end of the sequence.
static auto repeat(const element_t &element, xtd::usize count) -> xtd::collections::generic::enumerable_generator< element_t >
Generates a sequence that contains one repeated value.
static auto range(integer_t start, integer_t count, integer_t step) -> xtd::collections::generic::enumerable_generator< integer_t >
Generates a sequence of integral numbers within a specified range and step.
static auto first(source_t &&source) -> xtd::iterable_value_type< source_t >
Returns the first element of a sequence.
static auto as_enumerable(std::initializer_list< value_t > source) noexcept -> xtd::collections::generic::enumerable_generator< value_t >
Returns the input typed as xtd::collections::generic::ienumerable <type_t>.
xtd::collections::generic::key_value_pair< key_t, value_t > key_value_pair
Represents the key value pair value type.
Definition enumerable_.hpp:100
static auto order_by(source_t &&source, key_selector_t &&key_selector) -> xtd::collections::generic::enumerable_generator< xtd::iterable_value_type< source_t > >
Sorts the elements of a sequence in ascending order according to a key.
static auto min(source_t &&source, selector_t &&selector) -> result_t
Returns the minimum value in a sequence of xtd::numeric values.
static auto count(source_t &&source) noexcept -> xtd::usize
Returns the number of elements in a sequence.
static auto range(integer_t count) -> xtd::collections::generic::enumerable_generator< integer_t >
Generates a sequence of integral numbers within a specified range.
static auto first_or_default(source_t &&source) noexcept -> xtd::iterable_value_type< source_t >
Returns the first element of the sequence that satisfies a condition or a default value if no such el...
static auto reverse(source_t &&source) -> xtd::collections::generic::enumerable_generator< xtd::iterable_value_type< source_t > >
Inverts the order of the elements in a sequence.
static auto default_if_empty(source_t &&source, const xtd::iterable_value_type< source_t > &default_value) noexcept -> xtd::collections::generic::enumerable_generator< xtd::iterable_value_type< source_t > >
Returns the elements of the specified sequence or the specified value in a singleton collection if th...
static auto skip(source_t &&source, xtd::usize count) -> xtd::collections::generic::enumerable_generator< xtd::iterable_value_type< source_t > >
Bypasses a specified number of elements in a sequence and then returns the remaining elements.
static auto from(source_t &source) noexcept -> xtd::collections::generic::enumerable_generator< xtd::iterable_value_type< source_t > >
Returns the input typed as xtd::collections::generic::ienumerable <type_t>.
static auto count(source_t &&source, xtd::iterable_value_type< source_t > &&value) noexcept -> xtd::usize
Returns the number of elements with the specified value.
static auto max(source_t &&source) -> xtd::iterable_value_type< source_t >
Returns the maximum value in a sequence of xtd::numeric values.
static auto take(source_t &&source, const xtd::range &range) -> xtd::collections::generic::enumerable_generator< xtd::iterable_value_type< source_t > >
Returns a specified number of contiguous elements from the start of a sequence.
static auto take_while(source_t &&source, auto &&predicate) -> xtd::collections::generic::enumerable_generator< xtd::iterable_value_type< source_t > >
Returns elements from a sequence as long as a specified condition is true, and then skips the remaini...
static auto any(source_t &&source) noexcept -> bool
Determines whether a sequence contains any elements.
static auto count_by(source_t &&source, key_selector_t &&key_selector, key_equater_t &&key_equater) noexcept -> xtd::collections::generic::enumerable_generator< xtd::collections::generic::key_value_pair< key_t, xtd::usize > >
Returns the count of elements in the source sequence grouped by key.
static auto sequence_equal(first_t &&first, second_t &&second, equality_comparer_t &&comparer) -> bool
Determines whether two sequences are equal by comparing their elements by using a specifie the equali...
static auto to_list(const ienumerable< source_t > &source)
Creates a xtd::collections::generic::list <type_t> from an xtd::collections::generic::ienumerable <ty...
static auto average(source_t &&source) -> xtd::single
Computes the average of a sequence of float values.
static auto average(source_t &&source) -> xtd::optional< double >
Computes the average of a sequence of optional xtd::int32 values.
static auto average(source_t &&source) -> double
Computes the average of a sequence of xtd::int32 values.
Represents a range that has start and end indexes.
Definition range.hpp:38
Definition numeric.hpp:12
Definition real_decimal.hpp:13
Definition real_double.hpp:13
Definition real_single.hpp:13
Definition signed_integer_32.hpp:13
Definition signed_integer_64.hpp:14
Contains xtd::decimal type.
Contains xtd::collections::generic::equality_comparer <type_t> class.
Contains xtd::func_callable concept.
Contains xtd::collections::generic::comparer <type_t> class.
Contains xtd::collections::generic::enumerator <type_t> class.
xtd::raw_type< decltype(*std::begin(std::declval< iterable_t & >()))> iterable_value_type
Represents the orward iterable value type.
Definition iterable_value_type.hpp:29
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
#define static_
This keyword is use to represent a static object. A static object can't be instantiated (constructors...
Definition static.hpp:38
std::type_info type
Stores information about a type.
Definition type.hpp:23
char8_t char8
Represents a 8-bit unicode character.
Definition char8.hpp:26
wchar_t wchar
Represents a wide character.
Definition wchar.hpp:24
long double decimal
Represents a decimal-precision floating-point number.
Definition decimal.hpp:23
char16_t char16
Represents a 16-bit unicode character.
Definition char16.hpp:26
std::optional< type_t > optional
Represents the optional alias on std::optional.
Definition optional.hpp:26
std::size_t usize
Represents an unsigned size of any object in bytes.
Definition usize.hpp:22
float single
Represents a single-precision floating-point number.
Definition single.hpp:23
char32_t char32
Represents a 32-bit unicode character.
Definition char32.hpp:23
std::remove_cvref_t< value_t > raw_type
Represents a raw type alias equivalent to std::remove_cvref_t<value_t>.
Definition raw_type.hpp:25
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::iequatable interface.
Contains xtd::int32 type.
Contains xtd::int64 type.
Contains xtd::integer concept.
Contains xtd::iterable concept.
Contains xtd::iterable_value_type alias.
Contains xtd::collections::generic::helpers::lesser struct.
The xtd::collections::generic namespace contains interfaces and classes that define generic collectio...
Definition comparer.hpp:16
Provides classes and interfaces that support queries that use Language-Integrated Query (LINQ).
Definition enumerable_.hpp:60
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
constexpr auto length() const noexcept -> size_type
Returns the length of the current read_only_span.
Definition read_only_span.hpp:209
constexpr auto size() const noexcept -> size_type
Returns the number of elements.
Definition read_only_span.hpp:213
Contains xtd::numeric concept.
Contains xtd::optional type.
Contains xtd::predicate_callable concept.
Contains xtd::collections::generic::helpers::raw_array class.
Contains xtd::static_object class.
Supports a simple iteration over a generic collection.
Definition enumerator.hpp:39
Defines a key/value pair that can be set or retrieved.
Definition key_value_pair.hpp:37
Represents a type that can be used to index a collection either from the beginning or the end.
Definition index.hpp:38
Contains xtd::usize type.