493 #include "coveo/linq/exception.h" 495 #include <coveo/enumerable.h> 496 #include <coveo/linq/detail/linq_detail.h> 500 #include <functional> 527 template<
typename Seq>
528 auto from(
Seq&&
seq) ->
decltype(std::forward<Seq>(seq)) {
529 return std::forward<Seq>(seq);
553 template<
typename It>
555 ->
decltype(enumerate_range(std::move(ibeg), std::move(iend)))
557 return enumerate_range(std::move(ibeg), std::move(iend));
579 template<
typename IntT>
583 std::vector<
typename std::decay<IntT>::type> vvalues;
584 vvalues.reserve(count);
585 while (count-- > 0) {
586 vvalues.push_back(first++);
588 return enumerate_container(std::move(vvalues));
614 std::vector<
typename std::decay<T>::type> vvalues;
615 vvalues.reserve(count);
616 while (count-- > 0) {
617 vvalues.push_back(value);
619 return enumerate_container(std::move(vvalues));
639 template<
typename Seq,
typename Op>
640 auto operator|(
Seq&&
seq,
Op&&
op) ->
decltype(std::forward<Op>(op)(std::forward<Seq>(seq))) {
641 return std::forward<Op>(op)(std::forward<Seq>(seq));
686 -> detail::aggregate_impl_1<F>
688 return detail::aggregate_impl_1<F>(agg_f);
716 template<
typename Acc,
typename F>
718 -> detail::aggregate_impl_2<Acc, F>
720 return detail::aggregate_impl_2<Acc, F>(seed, agg_f);
752 template<
typename Acc,
typename F,
typename RF>
754 -> detail::aggregate_impl_3<Acc, F, RF>
756 return detail::aggregate_impl_3<Acc, F, RF>(seed, agg_f, result_f);
799 template<
typename Pred>
801 -> detail::all_impl<Pred>
803 return detail::all_impl<Pred>(pred);
842 template<
typename =
void>
844 -> detail::any_impl_0<>
846 return detail::any_impl_0<>();
877 template<
typename Pred>
879 -> detail::any_impl_1<Pred>
881 return detail::any_impl_1<Pred>(pred);
924 -> detail::average_impl<F>
926 return detail::average_impl<F>(num_f);
962 -> detail::select_impl<detail::indexless_selector_proxy<detail::cast_selector<U>>>
964 return detail::select_impl<detail::indexless_selector_proxy<detail::cast_selector<U>>>(
965 detail::indexless_selector_proxy<detail::cast_selector<U>>(detail::cast_selector<U>()));
1006 template<
typename Seq2>
1008 -> detail::concat_impl<Seq2>
1010 return detail::concat_impl<Seq2>(std::forward<Seq2>(seq2));
1049 template<
typename T>
1051 -> detail::contains_impl_1<T>
1053 return detail::contains_impl_1<T>(obj);
1084 template<
typename T,
typename Pred>
1086 -> detail::contains_impl_2<T, Pred>
1088 return detail::contains_impl_2<T, Pred>(obj, pred);
1123 template<
typename =
void>
1125 -> detail::count_impl_0<>
1127 return detail::count_impl_0<>();
1151 template<
typename Pred>
1153 -> detail::count_impl_1<Pred>
1155 return detail::count_impl_1<Pred>(pred);
1194 template<
typename =
void>
1196 -> detail::default_if_empty_impl_0<>
1198 return detail::default_if_empty_impl_0<>();
1227 template<
typename T>
1229 -> detail::default_if_empty_impl_1<T>
1231 return detail::default_if_empty_impl_1<T>(obj);
1268 template<
typename =
void>
1270 -> detail::distinct_impl<detail::less<>>
1272 return detail::distinct_impl<detail::less<>>(detail::less<>());
1302 template<
typename Pred>
1304 -> detail::distinct_impl<Pred>
1306 return detail::distinct_impl<Pred>(std::forward<Pred>(pred));
1348 template<
typename =
void>
1350 -> detail::element_at_impl<>
1352 return detail::element_at_impl<>(n);
1394 template<
typename =
void>
1396 -> detail::element_at_or_default_impl<>
1398 return detail::element_at_or_default_impl<>(n);
1441 template<
typename Seq2>
1443 -> detail::except_impl<Seq2, detail::less<>>
1445 return detail::except_impl<Seq2, detail::less<>>(std::forward<Seq2>(seq2), detail::less<>());
1477 template<
typename Seq2,
typename Pred>
1479 -> detail::except_impl<Seq2, Pred>
1481 return detail::except_impl<Seq2, Pred>(std::forward<Seq2>(seq2), std::forward<Pred>(pred));
1524 template<
typename =
void>
1526 -> detail::first_impl_0<>
1528 return detail::first_impl_0<>();
1560 template<
typename Pred>
1562 -> detail::first_impl_1<Pred>
1564 return detail::first_impl_1<Pred>(pred);
1607 template<
typename =
void>
1609 -> detail::first_or_default_impl_0<>
1611 return detail::first_or_default_impl_0<>();
1641 template<
typename Pred>
1643 -> detail::first_or_default_impl_1<Pred>
1645 return detail::first_or_default_impl_1<Pred>(pred);
1700 template<
typename KeySelector>
1702 -> detail::group_by_impl<KeySelector,
1707 return detail::group_by_impl<KeySelector,
1710 detail::less<>>(std::forward<KeySelector>(key_sel),
1711 detail::identity<>(),
1712 detail::pair_of<>(),
1758 template<
typename KeySelector,
1762 -> detail::group_by_impl<KeySelector,
1767 return detail::group_by_impl<KeySelector,
1770 Pred>(std::forward<KeySelector>(key_sel),
1771 detail::identity<>(),
1772 detail::pair_of<>(),
1773 std::forward<Pred>(pred));
1818 template<
typename KeySelector,
1819 typename ValueSelector>
1822 -> detail::group_by_impl<KeySelector,
1827 return detail::group_by_impl<KeySelector,
1830 detail::less<>>(std::forward<KeySelector>(key_sel),
1831 std::forward<ValueSelector>(value_sel),
1832 detail::pair_of<>(),
1881 template<
typename KeySelector,
1882 typename ValueSelector,
1887 -> detail::group_by_impl<KeySelector,
1892 return detail::group_by_impl<KeySelector,
1895 Pred>(std::forward<KeySelector>(key_sel),
1896 std::forward<ValueSelector>(value_sel),
1897 detail::pair_of<>(),
1898 std::forward<Pred>(pred));
1936 template<
typename KeySelector,
1937 typename ResultSelector>
1940 -> detail::group_by_impl<KeySelector,
1945 return detail::group_by_impl<KeySelector,
1948 detail::less<>>(std::forward<KeySelector>(key_sel),
1949 detail::identity<>(),
1950 std::forward<ResultSelector>(result_sel),
1992 template<
typename KeySelector,
1993 typename ResultSelector,
1998 -> detail::group_by_impl<KeySelector,
2003 return detail::group_by_impl<KeySelector,
2006 Pred>(std::forward<KeySelector>(key_sel),
2007 detail::identity<>(),
2008 std::forward<ResultSelector>(result_sel),
2009 std::forward<Pred>(pred));
2050 template<
typename KeySelector,
2051 typename ValueSelector,
2052 typename ResultSelector>
2056 -> detail::group_by_impl<KeySelector,
2061 return detail::group_by_impl<KeySelector,
2064 detail::less<>>(std::forward<KeySelector>(key_sel),
2065 std::forward<ValueSelector>(value_sel),
2066 std::forward<ResultSelector>(result_sel),
2111 template<
typename KeySelector,
2112 typename ValueSelector,
2113 typename ResultSelector,
2119 -> detail::group_by_impl<KeySelector,
2124 return detail::group_by_impl<KeySelector,
2127 Pred>(std::forward<KeySelector>(key_sel),
2128 std::forward<ValueSelector>(value_sel),
2129 std::forward<ResultSelector>(result_sel),
2130 std::forward<Pred>(pred));
2204 template<
typename InnerSeq,
2205 typename OuterKeySelector,
2206 typename InnerKeySelector,
2207 typename ResultSelector>
2212 -> detail::group_join_impl<InnerSeq,
2218 return detail::group_join_impl<InnerSeq,
2222 detail::less<>>(std::forward<InnerSeq>(inner_seq),
2223 std::forward<OuterKeySelector>(outer_key_sel),
2224 std::forward<InnerKeySelector>(inner_key_sel),
2225 std::forward<ResultSelector>(result_sel),
2289 template<
typename InnerSeq,
2290 typename OuterKeySelector,
2291 typename InnerKeySelector,
2292 typename ResultSelector,
2299 -> detail::group_join_impl<InnerSeq,
2305 return detail::group_join_impl<InnerSeq,
2309 Pred>(std::forward<InnerSeq>(inner_seq),
2310 std::forward<OuterKeySelector>(outer_key_sel),
2311 std::forward<InnerKeySelector>(inner_key_sel),
2312 std::forward<ResultSelector>(result_sel),
2313 std::forward<Pred>(pred));
2354 template<
typename Seq2>
2356 -> detail::intersect_impl<Seq2, detail::less<>>
2358 return detail::intersect_impl<Seq2, detail::less<>>(std::forward<Seq2>(seq2),
2390 template<
typename Seq2,
typename Pred>
2392 -> detail::intersect_impl<Seq2, Pred>
2394 return detail::intersect_impl<Seq2, Pred>(std::forward<Seq2>(seq2),
2395 std::forward<Pred>(pred));
2469 template<
typename InnerSeq,
2470 typename OuterKeySelector,
2471 typename InnerKeySelector,
2472 typename ResultSelector>
2477 -> detail::join_impl<InnerSeq,
2483 return detail::join_impl<InnerSeq,
2487 detail::less<>>(std::forward<InnerSeq>(inner_seq),
2488 std::forward<OuterKeySelector>(outer_key_sel),
2489 std::forward<InnerKeySelector>(inner_key_sel),
2490 std::forward<ResultSelector>(result_sel),
2553 template<
typename InnerSeq,
2554 typename OuterKeySelector,
2555 typename InnerKeySelector,
2556 typename ResultSelector,
2563 -> detail::join_impl<InnerSeq,
2569 return detail::join_impl<InnerSeq,
2573 Pred>(std::forward<InnerSeq>(inner_seq),
2574 std::forward<OuterKeySelector>(outer_key_sel),
2575 std::forward<InnerKeySelector>(inner_key_sel),
2576 std::forward<ResultSelector>(result_sel),
2577 std::forward<Pred>(pred));
2620 template<
typename =
void>
2622 -> detail::last_impl_0<>
2624 return detail::last_impl_0<>();
2656 template<
typename Pred>
2658 -> detail::last_impl_1<Pred>
2660 return detail::last_impl_1<Pred>(pred);
2703 template<
typename =
void>
2705 -> detail::last_or_default_impl_0<>
2707 return detail::last_or_default_impl_0<>();
2737 template<
typename Pred>
2739 -> detail::last_or_default_impl_1<Pred>
2741 return detail::last_or_default_impl_1<Pred>(pred);
2783 template<
typename =
void>
2785 -> detail::max_impl_0<>
2787 return detail::max_impl_0<>();
2818 template<
typename Selector>
2820 -> detail::max_impl_1<Selector>
2822 return detail::max_impl_1<Selector>(sel);
2864 template<
typename =
void>
2866 -> detail::min_impl_0<>
2868 return detail::min_impl_0<>();
2899 template<
typename Selector>
2901 -> detail::min_impl_1<Selector>
2903 return detail::min_impl_1<Selector>(sel);
2946 template<
typename Pred>
2948 -> detail::none_impl<Pred>
2950 return detail::none_impl<Pred>(pred);
3004 template<
typename KeySelector>
3006 -> detail::order_by_impl<detail::order_by_comparator<KeySelector, detail::less<>,
false>>
3008 typedef detail::order_by_comparator<KeySelector, detail::less<>,
false> comparator;
3009 return detail::order_by_impl<comparator>(detail::make_unique<comparator>(std::forward<KeySelector>(key_sel), detail::less<>()));
3052 template<
typename KeySelector,
typename Pred>
3054 -> detail::order_by_impl<detail::order_by_comparator<KeySelector, Pred,
false>>
3056 typedef detail::order_by_comparator<KeySelector, Pred,
false> comparator;
3057 return detail::order_by_impl<comparator>(detail::make_unique<comparator>(std::forward<KeySelector>(key_sel), std::forward<Pred>(pred)));
3098 template<
typename KeySelector>
3100 -> detail::order_by_impl<detail::order_by_comparator<KeySelector, detail::less<>,
true>>
3102 typedef detail::order_by_comparator<KeySelector, detail::less<>,
true> comparator;
3103 return detail::order_by_impl<comparator>(detail::make_unique<comparator>(std::forward<KeySelector>(key_sel), detail::less<>()));
3147 template<
typename KeySelector,
typename Pred>
3149 -> detail::order_by_impl<detail::order_by_comparator<KeySelector, Pred,
true>>
3151 typedef detail::order_by_comparator<KeySelector, Pred,
true> comparator;
3152 return detail::order_by_impl<comparator>(detail::make_unique<comparator>(std::forward<KeySelector>(key_sel), std::forward<Pred>(pred)));
3194 template<
typename KeySelector>
3196 ->
decltype(order_by(std::forward<KeySelector>(key_sel)))
3198 return order_by(std::forward<KeySelector>(key_sel));
3244 template<
typename KeySelector,
typename Pred>
3246 ->
decltype(order_by(std::forward<KeySelector>(key_sel), std::forward<Pred>(pred)))
3248 return order_by(std::forward<KeySelector>(key_sel), std::forward<Pred>(pred));
3291 template<
typename KeySelector>
3293 ->
decltype(order_by_descending(std::forward<KeySelector>(key_sel)))
3295 return order_by_descending(std::forward<KeySelector>(key_sel));
3342 template<
typename KeySelector,
typename Pred>
3344 ->
decltype(order_by_descending(std::forward<KeySelector>(key_sel), std::forward<Pred>(pred)))
3346 return order_by_descending(std::forward<KeySelector>(key_sel), std::forward<Pred>(pred));
3380 template<
typename =
void>
3382 -> detail::reverse_impl<>
3384 return detail::reverse_impl<>();
3425 template<
typename Selector>
3427 -> detail::select_impl<detail::indexless_selector_proxy<Selector>>
3429 return detail::select_impl<detail::indexless_selector_proxy<Selector>>(
3430 detail::indexless_selector_proxy<Selector>(std::forward<Selector>(sel)));
3461 template<
typename Selector>
3463 -> detail::select_impl<Selector>
3465 return detail::select_impl<Selector>(std::forward<Selector>(sel));
3499 template<
typename Selector>
3501 -> detail::select_many_impl<detail::indexless_selector_proxy<Selector>>
3503 return detail::select_many_impl<detail::indexless_selector_proxy<Selector>>(
3504 detail::indexless_selector_proxy<Selector>(std::forward<Selector>(sel)));
3542 template<
typename Selector>
3544 -> detail::select_many_impl<Selector>
3546 return detail::select_many_impl<Selector>(std::forward<Selector>(sel));
3592 template<
typename Seq2>
3594 -> detail::sequence_equal_impl_1<Seq2>
3596 return detail::sequence_equal_impl_1<Seq2>(seq2);
3632 template<
typename Seq2,
typename Pred>
3634 -> detail::sequence_equal_impl_2<Seq2, Pred>
3636 return detail::sequence_equal_impl_2<Seq2, Pred>(seq2, pred);
3685 template<
typename =
void>
3687 -> detail::single_impl_0<>
3689 return detail::single_impl_0<>();
3728 template<
typename Pred>
3730 -> detail::single_impl_1<Pred>
3732 return detail::single_impl_1<Pred>(pred);
3781 template<
typename =
void>
3783 -> detail::single_or_default_impl_0<>
3785 return detail::single_or_default_impl_0<>();
3823 template<
typename Pred>
3825 -> detail::single_or_default_impl_1<Pred>
3827 return detail::single_or_default_impl_1<Pred>(pred);
3865 template<
typename =
void>
3867 -> detail::skip_impl<detail::skip_n_pred<>>
3869 return detail::skip_impl<detail::skip_n_pred<>>(detail::skip_n_pred<>(n), n);
3896 template<
typename Pred>
3898 -> detail::skip_impl<detail::indexless_selector_proxy<Pred>>
3900 return detail::skip_impl<detail::indexless_selector_proxy<Pred>>(detail::indexless_selector_proxy<Pred>(std::forward<Pred>(pred)),
3901 static_cast<std::size_t>(-1));
3931 template<
typename Pred>
3933 -> detail::skip_impl<Pred>
3935 return detail::skip_impl<Pred>(std::forward<Pred>(pred),
3936 static_cast<std::size_t>(-1));
3977 template<
typename F>
3979 -> detail::sum_impl<F>
3981 return detail::sum_impl<F>(num_f);
4019 template<
typename =
void>
4021 -> detail::take_impl<detail::skip_n_pred<>>
4023 return detail::take_impl<detail::skip_n_pred<>>(detail::skip_n_pred<>(n), n);
4050 template<
typename Pred>
4052 -> detail::take_impl<detail::indexless_selector_proxy<Pred>>
4054 return detail::take_impl<detail::indexless_selector_proxy<Pred>>(detail::indexless_selector_proxy<Pred>(std::forward<Pred>(pred)),
4055 static_cast<std::size_t>(-1));
4085 template<
typename Pred>
4087 -> detail::take_impl<Pred>
4089 return detail::take_impl<Pred>(std::forward<Pred>(pred),
4090 static_cast<std::size_t>(-1));
4129 template<
typename Container>
4131 -> detail::to_impl<Container>
4133 return detail::to_impl<Container>();
4158 template<
typename =
void>
4160 -> detail::to_vector_impl<>
4162 return detail::to_vector_impl<>();
4200 template<
typename Container,
4201 typename KeySelector>
4203 -> detail::to_associative_impl_1<Container, KeySelector>
4205 return detail::to_associative_impl_1<Container, KeySelector>(key_sel);
4246 template<
typename Container,
4247 typename KeySelector,
4248 typename ElementSelector>
4251 -> detail::to_associative_impl_2<Container, KeySelector, ElementSelector>
4253 return detail::to_associative_impl_2<Container, KeySelector, ElementSelector>(key_sel, elem_sel);
4290 template<
typename KeySelector>
4292 -> detail::to_map_impl_1<KeySelector>
4294 return detail::to_map_impl_1<KeySelector>(key_sel);
4334 template<
typename KeySelector,
4335 typename ElementSelector>
4338 -> detail::to_map_impl_2<KeySelector, ElementSelector>
4340 return detail::to_map_impl_2<KeySelector, ElementSelector>(key_sel, elem_sel);
4382 template<
typename Seq2>
4384 -> detail::union_impl<Seq2, detail::less<>>
4386 return detail::union_impl<Seq2, detail::less<>>(std::forward<Seq2>(seq2),
4418 template<
typename Seq2,
typename Pred>
4420 -> detail::union_impl<Seq2, Pred>
4422 return detail::union_impl<Seq2, Pred>(std::forward<Seq2>(seq2),
4423 std::forward<Pred>(pred));
4460 template<
typename Pred>
4462 -> detail::where_impl<detail::indexless_selector_proxy<Pred>>
4464 return detail::where_impl<detail::indexless_selector_proxy<Pred>>(
4465 detail::indexless_selector_proxy<Pred>(std::forward<Pred>(pred)));
4494 template<
typename Pred>
4496 -> detail::where_impl<Pred>
4498 return detail::where_impl<Pred>(std::forward<Pred>(pred));
4544 template<
typename Seq2,
4545 typename ResultSelector>
4547 -> detail::zip_impl<Seq2, ResultSelector>
4549 return detail::zip_impl<Seq2, ResultSelector>(std::forward<Seq2>(seq2),
4550 std::forward<ResultSelector>(result_sel));
auto join(InnerSeq &&inner_seq, OuterKeySelector &&outer_key_sel, InnerKeySelector &&inner_key_sel, ResultSelector &&result_sel, Pred &&pred) -> detail::join_impl< InnerSeq, OuterKeySelector, InnerKeySelector, ResultSelector, Pred >
Joins elements in two sequences according to their keys using predicate.
Definition: linq.h:2558
auto to() -> detail::to_impl< Container >
Converts sequence into another container.
Definition: linq.h:4130
auto select_many_with_index(Selector &&sel) -> detail::select_many_impl< Selector >
Projects elements in sequence into many values using element index and flattens them.
Definition: linq.h:3543
auto select_many(Selector &&sel) -> detail::select_many_impl< detail::indexless_selector_proxy< Selector >>
Projects elements in sequence into many values and flattens them.
Definition: linq.h:3500
auto contains(const T &obj, const Pred &pred) -> detail::contains_impl_2< T, Pred >
Look for element in a sequence using a predicate.
Definition: linq.h:1085
auto any() -> detail::any_impl_0<>
Checks for any element.
Definition: linq.h:843
auto to_vector() -> detail::to_vector_impl<>
Converts sequence into std::vector.
Definition: linq.h:4159
auto skip_while(Pred &&pred) -> detail::skip_impl< detail::indexless_selector_proxy< Pred >>
Skips the first elements in sequence satisfying predicate.
Definition: linq.h:3897
auto count() -> detail::count_impl_0<>
Counts elements in sequence.
Definition: linq.h:1124
auto min() -> detail::min_impl_0<>
Returns minimum element in sequence.
Definition: linq.h:2865
auto union_with(Seq2 &&seq2) -> detail::union_impl< Seq2, detail::less<>>
Performs set union of two sequences.
Definition: linq.h:4383
auto last_or_default(const Pred &pred) -> detail::last_or_default_impl_1< Pred >
Returns last element in sequence that satisfy predicate, or default value.
Definition: linq.h:2738
auto to_map(const KeySelector &key_sel, const ElementSelector &elem_sel) -> detail::to_map_impl_2< KeySelector, ElementSelector >
Converts sequence into std::map using key and element selector.
Definition: linq.h:4336
auto max() -> detail::max_impl_0<>
Returns maximum element in sequence.
Definition: linq.h:2784
auto group_by_and_fold(KeySelector &&key_sel, ResultSelector &&result_sel) -> detail::group_by_impl< KeySelector, detail::identity<>, ResultSelector, detail::less<>>
Groups elements in sequence according to their keys then folds the results.
Definition: linq.h:1938
auto sequence_equal(const Seq2 &seq2, const Pred &pred) -> detail::sequence_equal_impl_2< Seq2, Pred >
Compares elements in two sequences using predicate.
Definition: linq.h:3633
auto distinct() -> detail::distinct_impl< detail::less<>>
Filters out duplicate elements in sequence.
Definition: linq.h:1269
auto aggregate(const F &agg_f) -> detail::aggregate_impl_1< F >
Aggregates values using an aggregation function.
Definition: linq.h:685
auto group_by(KeySelector &&key_sel, Pred &&pred) -> detail::group_by_impl< KeySelector, detail::identity<>, detail::pair_of<>, Pred >
Groups elements in sequence according to their keys using predicate.
Definition: linq.h:1760
auto then_by_descending(KeySelector &&key_sel, Pred &&pred) -> decltype(order_by_descending(std::forward< KeySelector >(key_sel), std::forward< Pred >(pred)))
Further orders elements in sequence by descending key using predicate.
Definition: linq.h:3343
auto any(const Pred &pred) -> detail::any_impl_1< Pred >
Checks for any element that satisfy a predicate.
Definition: linq.h:878
auto except(Seq2 &&seq2, Pred &&pred) -> detail::except_impl< Seq2, Pred >
Performs set difference between two sequences using predicate.
Definition: linq.h:1478
auto max(const Selector &sel) -> detail::max_impl_1< Selector >
Returns maximum projected value in sequence.
Definition: linq.h:2819
auto all(const Pred &pred) -> detail::all_impl< Pred >
Checks elements in a sequence against a predicate.
Definition: linq.h:800
auto intersect(Seq2 &&seq2, Pred &&pred) -> detail::intersect_impl< Seq2, Pred >
Performs set intersection of two sequences using predicate.
Definition: linq.h:2391
auto from_range(It ibeg, It iend) -> decltype(enumerate_range(std::move(ibeg), std::move(iend)))
LINQ expression entry point from iterators.
Definition: linq.h:554
auto group_values_by(KeySelector &&key_sel, ValueSelector &&value_sel, Pred &&pred) -> detail::group_by_impl< KeySelector, ValueSelector, detail::pair_of<>, Pred >
Groups values in sequence according to their keys using predicate.
Definition: linq.h:1884
auto then_by(KeySelector &&key_sel) -> decltype(order_by(std::forward< KeySelector >(key_sel)))
Further orders elements in sequence by ascending key.
Definition: linq.h:3195
auto first() -> detail::first_impl_0<>
Returns first element in sequence.
Definition: linq.h:1525
auto union_with(Seq2 &&seq2, Pred &&pred) -> detail::union_impl< Seq2, Pred >
Performs set union of two sequences using predicate.
Definition: linq.h:4419
auto sum(const F &num_f) -> detail::sum_impl< F >
Computes sum using numerical function.
Definition: linq.h:3978
auto from_int_range(IntT first, std::size_t count) -> coveo::enumerable< const typename std::decay< IntT >::type >
LINQ expression entry point from range of numbers.
Definition: linq.h:580
auto take_while_with_index(Pred &&pred) -> detail::take_impl< Pred >
Keeps the first elements in sequence satisfying predicate using element index.
Definition: linq.h:4086
auto operator|(Seq &&seq, Op &&op) -> decltype(std::forward< Op >(op)(std::forward< Seq >(seq)))
Applies LINQ operators and allows chaining.
Definition: linq.h:640
auto take(std::size_t n) -> detail::take_impl< detail::skip_n_pred<>>
Keeps the first N elements in sequence.
Definition: linq.h:4020
auto intersect(Seq2 &&seq2) -> detail::intersect_impl< Seq2, detail::less<>>
Performs set intersection of two sequences.
Definition: linq.h:2355
auto last() -> detail::last_impl_0<>
Returns last element in sequence.
Definition: linq.h:2621
auto single_or_default() -> detail::single_or_default_impl_0<>
Returns only element in sequence, or default value.
Definition: linq.h:3782
auto except(Seq2 &&seq2) -> detail::except_impl< Seq2, detail::less<>>
Performs set difference between two sequences.
Definition: linq.h:1442
auto take_while(Pred &&pred) -> detail::take_impl< detail::indexless_selector_proxy< Pred >>
Keeps the first elements in sequence satisfying predicate.
Definition: linq.h:4051
auto join(InnerSeq &&inner_seq, OuterKeySelector &&outer_key_sel, InnerKeySelector &&inner_key_sel, ResultSelector &&result_sel) -> detail::join_impl< InnerSeq, OuterKeySelector, InnerKeySelector, ResultSelector, detail::less<>>
Joins elements in two sequences according to their keys.
Definition: linq.h:2473
auto then_by(KeySelector &&key_sel, Pred &&pred) -> decltype(order_by(std::forward< KeySelector >(key_sel), std::forward< Pred >(pred)))
Further orders elements in sequence by ascending key using predicate.
Definition: linq.h:3245
auto first_or_default(const Pred &pred) -> detail::first_or_default_impl_1< Pred >
Returns first element in sequence that satisfy predicate, or default value.
Definition: linq.h:1642
auto min(const Selector &sel) -> detail::min_impl_1< Selector >
Returns minimum projected value in sequence.
Definition: linq.h:2900
auto count(const Pred &pred) -> detail::count_impl_1< Pred >
Counts elements in sequence satisfying a predicate.
Definition: linq.h:1152
auto order_by_descending(KeySelector &&key_sel, Pred &&pred) -> detail::order_by_impl< detail::order_by_comparator< KeySelector, Pred, true >>
Orders elements in sequence by descending key using predicate.
Definition: linq.h:3148
auto element_at_or_default(std::size_t n) -> detail::element_at_or_default_impl<>
Returns nth element in sequence or default value.
Definition: linq.h:1395
auto aggregate(const Acc &seed, const F &agg_f) -> detail::aggregate_impl_2< Acc, F >
Aggregates values using an aggregation function, starting with a seed.
Definition: linq.h:717
auto from_repeated(const T &value, std::size_t count) -> coveo::enumerable< const typename std::decay< T >::type >
LINQ expression entry point from a repeated value.
Definition: linq.h:611
auto none(const Pred &pred) -> detail::none_impl< Pred >
Checks elements in a sequence against a predicate.
Definition: linq.h:2947
auto select_with_index(Selector &&sel) -> detail::select_impl< Selector >
Projects elements in sequence into another form using element index.
Definition: linq.h:3462
auto select(Selector &&sel) -> detail::select_impl< detail::indexless_selector_proxy< Selector >>
Projects elements in sequence into another form.
Definition: linq.h:3426
auto order_by(KeySelector &&key_sel, Pred &&pred) -> detail::order_by_impl< detail::order_by_comparator< KeySelector, Pred, false >>
Orders elements in sequence by ascending key using predicate.
Definition: linq.h:3053
auto concat(Seq2 &&seq2) -> detail::concat_impl< Seq2 >
Concatenates two sequences.
Definition: linq.h:1007
auto to_map(const KeySelector &key_sel) -> detail::to_map_impl_1< KeySelector >
Converts sequence into std::map using key selector.
Definition: linq.h:4291
Type-erased sequence wrapper.
Definition: enumerable.h:62
auto first_or_default() -> detail::first_or_default_impl_0<>
Returns first element in sequence, or default value.
Definition: linq.h:1608
auto group_by_and_fold(KeySelector &&key_sel, ResultSelector &&result_sel, Pred &&pred) -> detail::group_by_impl< KeySelector, detail::identity<>, ResultSelector, Pred >
Groups elements in sequence according to their keys using predicate, then folds the results.
Definition: linq.h:1995
auto default_if_empty() -> detail::default_if_empty_impl_0<>
Ensures sequence has at least one element.
Definition: linq.h:1195
auto order_by_descending(KeySelector &&key_sel) -> detail::order_by_impl< detail::order_by_comparator< KeySelector, detail::less<>, true >>
Orders elements in sequence by descending key.
Definition: linq.h:3099
auto first(const Pred &pred) -> detail::first_impl_1< Pred >
Returns first element in sequence that satisfy predicate.
Definition: linq.h:1561
auto where_with_index(Pred &&pred) -> detail::where_impl< Pred >
Filters sequence elements using predicate and element index.
Definition: linq.h:4495
auto skip_while_with_index(Pred &&pred) -> detail::skip_impl< Pred >
Skips the first elements in sequence satisfying predicate using element index.
Definition: linq.h:3932
auto group_join(InnerSeq &&inner_seq, OuterKeySelector &&outer_key_sel, InnerKeySelector &&inner_key_sel, ResultSelector &&result_sel, Pred &&pred) -> detail::group_join_impl< InnerSeq, OuterKeySelector, InnerKeySelector, ResultSelector, Pred >
Joins and groups elements in two sequences according to their keys using predicate.
Definition: linq.h:2294
auto single(const Pred &pred) -> detail::single_impl_1< Pred >
Returns only element in sequence satisfying predicate.
Definition: linq.h:3729
auto skip(std::size_t n) -> detail::skip_impl< detail::skip_n_pred<>>
Skips the first N elements in sequence.
Definition: linq.h:3866
auto sequence_equal(const Seq2 &seq2) -> detail::sequence_equal_impl_1< Seq2 >
Compares elements in two sequences.
Definition: linq.h:3593
auto zip(Seq2 &&seq2, ResultSelector &&result_sel) -> detail::zip_impl< Seq2, ResultSelector >
Zips two sequences.
Definition: linq.h:4546
auto order_by(KeySelector &&key_sel) -> detail::order_by_impl< detail::order_by_comparator< KeySelector, detail::less<>, false >>
Orders elements in sequence by ascending key.
Definition: linq.h:3005
auto reverse() -> detail::reverse_impl<>
Reverses elements in sequence.
Definition: linq.h:3381
auto contains(const T &obj) -> detail::contains_impl_1< T >
Look for element in a sequence.
Definition: linq.h:1050
auto single_or_default(const Pred &pred) -> detail::single_or_default_impl_1< Pred >
Returns only element in sequence satisfying predicate, or default value.
Definition: linq.h:3824
auto average(const F &num_f) -> detail::average_impl< F >
Computes average using numerical function.
Definition: linq.h:923
auto last(const Pred &pred) -> detail::last_impl_1< Pred >
Returns last element in sequence that satisfy predicate.
Definition: linq.h:2657
auto group_values_by(KeySelector &&key_sel, ValueSelector &&value_sel) -> detail::group_by_impl< KeySelector, ValueSelector, detail::pair_of<>, detail::less<>>
Groups values in sequence according to their keys.
Definition: linq.h:1820
auto then_by_descending(KeySelector &&key_sel) -> decltype(order_by_descending(std::forward< KeySelector >(key_sel)))
Further orders elements in sequence by descending key.
Definition: linq.h:3292
auto to_associative(const KeySelector &key_sel) -> detail::to_associative_impl_1< Container, KeySelector >
Converts sequence into associative container using key selector.
Definition: linq.h:4202
auto single() -> detail::single_impl_0<>
Returns only element in sequence.
Definition: linq.h:3686
auto group_values_by_and_fold(KeySelector &&key_sel, ValueSelector &&value_sel, ResultSelector &&result_sel, Pred &&pred) -> detail::group_by_impl< KeySelector, ValueSelector, ResultSelector, Pred >
Groups values in sequence according to their keys using predicate, then folds the results.
Definition: linq.h:2115
auto last_or_default() -> detail::last_or_default_impl_0<>
Returns last element in sequence, or default value.
Definition: linq.h:2704
auto group_values_by_and_fold(KeySelector &&key_sel, ValueSelector &&value_sel, ResultSelector &&result_sel) -> detail::group_by_impl< KeySelector, ValueSelector, ResultSelector, detail::less<>>
Groups values in sequence according to their keys then folds the results.
Definition: linq.h:2053
auto distinct(Pred &&pred) -> detail::distinct_impl< Pred >
Filters out duplicate elements in sequence using predicate.
Definition: linq.h:1303
auto group_by(KeySelector &&key_sel) -> detail::group_by_impl< KeySelector, detail::identity<>, detail::pair_of<>, detail::less<>>
Groups elements in sequence according to their keys.
Definition: linq.h:1701
auto cast() -> detail::select_impl< detail::indexless_selector_proxy< detail::cast_selector< U >>>
Casts sequence elements to another type.
Definition: linq.h:961
auto default_if_empty(const T &obj) -> detail::default_if_empty_impl_1< T >
Ensures sequence has at least one element, specifying said element.
Definition: linq.h:1228
auto to_associative(const KeySelector &key_sel, const ElementSelector &elem_sel) -> detail::to_associative_impl_2< Container, KeySelector, ElementSelector >
Converts sequence into associative container using key and element selector.
Definition: linq.h:4249
auto element_at(std::size_t n) -> detail::element_at_impl<>
Returns nth element in sequence.
Definition: linq.h:1349
auto group_join(InnerSeq &&inner_seq, OuterKeySelector &&outer_key_sel, InnerKeySelector &&inner_key_sel, ResultSelector &&result_sel) -> detail::group_join_impl< InnerSeq, OuterKeySelector, InnerKeySelector, ResultSelector, detail::less<>>
Joins and groups elements in two sequences according to their keys.
Definition: linq.h:2208
auto aggregate(const Acc &seed, const F &agg_f, const RF &result_f) -> detail::aggregate_impl_3< Acc, F, RF >
Aggregates values using aggregation function, seed and result selector.
Definition: linq.h:753
auto where(Pred &&pred) -> detail::where_impl< detail::indexless_selector_proxy< Pred >>
Filters sequence elements using predicate.
Definition: linq.h:4461
auto from(Seq &&seq) -> decltype(std::forward< Seq >(seq))
Standard LINQ expression entry point.
Definition: linq.h:528