coveo::linq
Implementation of .NET-like LINQ operators in C++
|
Groups elements in a sequence according to their keys. More...
Functions | |
template<typename KeySelector > | |
auto | coveo::linq::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. More... | |
template<typename KeySelector , typename Pred > | |
auto | coveo::linq::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. More... | |
template<typename KeySelector , typename ValueSelector > | |
auto | coveo::linq::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. More... | |
template<typename KeySelector , typename ValueSelector , typename Pred > | |
auto | coveo::linq::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. More... | |
template<typename KeySelector , typename ResultSelector > | |
auto | coveo::linq::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. More... | |
template<typename KeySelector , typename ResultSelector , typename Pred > | |
auto | coveo::linq::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. More... | |
template<typename KeySelector , typename ValueSelector , typename ResultSelector > | |
auto | coveo::linq::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. More... | |
template<typename KeySelector , typename ValueSelector , typename ResultSelector , typename Pred > | |
auto | coveo::linq::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. More... | |
The group_by
operator (and its siblings) group elements in a sequence according to their keys. Keys are extracted from elements using a key selector. Variants of the operator can also extract values from elements using a value selector, or modify the resulting sequence using a result selector.
.NET equivalent: GroupBy
auto coveo::linq::group_by | ( | KeySelector && | key_sel | ) | -> detail::group_by_impl<KeySelector, detail::identity<>, detail::pair_of<>, detail::less<>> |
Scans the input sequence and, for each element, fetches a key using the provided key selector. Then, creates groups of elements that have a common key. The result is a sequence of pair
s whose first
element is a key and whose second
element is a sequence of elements matching that key. The groups are returned in ascending order of key, as determined by operator<()
.
Use like this:
key_sel | Key selector, used to extract a key for a sequence element. |
pair
s whose first
element is a key and whose second
element is a sequence of matching elements. auto coveo::linq::group_by | ( | KeySelector && | key_sel, |
Pred && | pred | ||
) | -> detail::group_by_impl<KeySelector, detail::identity<>, detail::pair_of<>, Pred> |
Scans the input sequence and, for each element, fetches a key using the provided key selector. Then, creates groups of elements that have a common key. The result is a sequence of pair
s whose first
element is a key and whose second
element is a sequence of elements matching that key. The groups are returned in order of key, as determined by the provided predicate. The predicate must provide a strict ordering of the keys, like std::less
.
Use like this:
key_sel | Key selector, used to extract a key for a sequence element. |
pred | Predicate used to compare the keys. |
pair
s whose first
element is a key and whose second
element is a sequence of matching elements. auto coveo::linq::group_values_by | ( | KeySelector && | key_sel, |
ValueSelector && | value_sel | ||
) | -> detail::group_by_impl<KeySelector, ValueSelector, detail::pair_of<>, detail::less<>> |
Scans the input sequence and, for each element, fetches a key using the provided key selector and a value using the provided value selector. Then, creates groups of values that have a common key. The result is a sequence of pair
s whose first
element is a key and whose second
element is a sequence of values matching that key. The groups are returned in ascending order of key, as determined by operator<()
.
Use like this:
key_sel | Key selector, used to extract a key for a sequence element. |
value_sel | Value selector, used to extract a value for a sequence element. |
pair
s whose first
element is a key and whose second
element is a sequence of matching values. auto coveo::linq::group_values_by | ( | KeySelector && | key_sel, |
ValueSelector && | value_sel, | ||
Pred && | pred | ||
) | -> detail::group_by_impl<KeySelector, ValueSelector, detail::pair_of<>, Pred> |
Scans the input sequence and, for each element, fetches a key using the provided key selector and a value using the provided value selector. Then, creates groups of values that have a common key. The result is a sequence of pair
s whose first
element is a key and whose second
element is a sequence of values matching that key. The groups are returned in order of key, as determined by the provided predicate. The predicate must provide a strict ordering of the keys, like std::less
.
Use like this:
key_sel | Key selector, used to extract a key for a sequence element. |
value_sel | Value selector, used to extract a value for a sequence element. |
pred | Predicate used to compare the keys. |
pair
s whose first
element is a key and whose second
element is a sequence of matching values. auto coveo::linq::group_by_and_fold | ( | KeySelector && | key_sel, |
ResultSelector && | result_sel | ||
) | -> detail::group_by_impl<KeySelector, detail::identity<>, ResultSelector, detail::less<>> |
Scans the input sequence and, for each element, fetches a key using the provided key selector. Then, creates groups of elements that have a common key and uses the provided result selector to convert the groups. The result selector is called with two arguments: a key, and a sequence of elements matching that key. The final result is a sequence of the values returned by the result selector. The result selector is called in ascending order of key, as determined by operator<()
.
Use like this:
key_sel | Key selector, used to extract a key for a sequence element. |
result_sel | Result selector, used to fold groups into final results. |
result_sel
. auto coveo::linq::group_by_and_fold | ( | KeySelector && | key_sel, |
ResultSelector && | result_sel, | ||
Pred && | pred | ||
) | -> detail::group_by_impl<KeySelector, detail::identity<>, ResultSelector, Pred> |
Scans the input sequence and, for each element, fetches a key using the provided key selector. Then, creates groups of elements that have a common key and uses the provided result selector to convert the groups. The result selector is called with two arguments: a key, and a sequence of elements matching that key. The final result is a sequence of the values returned by the result selector. The result selector is called in order of key, as determined by the provided predicate. The predicate must provide a strict ordering of the keys, like std::less
.
Use like this:
key_sel | Key selector, used to extract a key for a sequence element. |
result_sel | Result selector, used to fold groups into final results. |
pred | Predicate used to compare the keys. |
result_sel
. auto coveo::linq::group_values_by_and_fold | ( | KeySelector && | key_sel, |
ValueSelector && | value_sel, | ||
ResultSelector && | result_sel | ||
) | -> detail::group_by_impl<KeySelector, ValueSelector, ResultSelector, detail::less<>> |
Scans the input sequence and, for each element, fetches a key using the provided key selector and a value using the provided value selector. Then, creates groups of values that have a common key and uses the provided result selector to convert the groups. The result selector is called with two arguments: a key, and a sequence of values matching that key. The final result is a sequence of the values returned by the result selector. The result selector is called in ascending order of key, as determined by operator<()
.
Use like this:
key_sel | Key selector, used to extract a key for a sequence element. |
value_sel | Value selector, used to extract a value for a sequence element. |
result_sel | Result selector, used to fold groups into final results. |
result_sel
. auto coveo::linq::group_values_by_and_fold | ( | KeySelector && | key_sel, |
ValueSelector && | value_sel, | ||
ResultSelector && | result_sel, | ||
Pred && | pred | ||
) | -> detail::group_by_impl<KeySelector, ValueSelector, ResultSelector, Pred> |
Scans the input sequence and, for each element, fetches a key using the provided key selector and a value using the provided value selector. Then, creates groups of values that have a common key and uses the provided result selector to convert the groups. The result selector is called with two arguments: a key, and a sequence of values matching that key. The final result is a sequence of the values returned by the result selector. The result selector is called in order of key, as determined by the provided predicate. The predicate must provide a strict ordering of the keys, like std::less
.
Use like this:
key_sel | Key selector, used to extract a key for a sequence element. |
value_sel | Value selector, used to extract a value for a sequence element. |
result_sel | Result selector, used to fold groups into final results. |
pred | Predicate used to compare the keys. |
result_sel
.