coveo::linq
Implementation of .NET-like LINQ operators in C++
|
Converts a sequence into another container type. More...
Functions | |
template<typename Container > | |
auto | coveo::linq::to () -> detail::to_impl< Container > |
Converts sequence into another container. More... | |
template<typename = void> | |
auto | coveo::linq::to_vector () -> detail::to_vector_impl<> |
Converts sequence into std::vector . More... | |
template<typename Container , typename KeySelector > | |
auto | coveo::linq::to_associative (const KeySelector &key_sel) -> detail::to_associative_impl_1< Container, KeySelector > |
Converts sequence into associative container using key selector. More... | |
template<typename Container , typename KeySelector , typename ElementSelector > | |
auto | coveo::linq::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. More... | |
template<typename KeySelector > | |
auto | coveo::linq::to_map (const KeySelector &key_sel) -> detail::to_map_impl_1< KeySelector > |
Converts sequence into std::map using key selector. More... | |
template<typename KeySelector , typename ElementSelector > | |
auto | coveo::linq::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. More... | |
The to
operator (and its siblings) converts a sequence into another type of container.
This is a terminal operator if the resulting container is not in itself a valid sequence.
.NET equivalent: ToArray / ToDictionary / ToList / ToLookup
auto coveo::linq::to | ( | ) | -> detail::to_impl<Container> |
Given a source sequence, returns a new container of the provided type that contains the source sequence's elements.
Use like this:
Container | Type of container to convert to. |
Container
storing the same elements as source sequence. auto coveo::linq::to_vector | ( | ) | -> detail::to_vector_impl<> |
Given a source sequence, returns a new std::vector
that contains the source sequence's elements. The vector's element type is auto-detected from the source sequence.
Use like this:
std::vector
storing the same elements as source sequence. auto coveo::linq::to_associative | ( | const KeySelector & | key_sel | ) | -> detail::to_associative_impl_1<Container, KeySelector> |
Given a source sequence, returns a new associative container of the provided type that maps each element's key, as extracted by the provided key selector, to the corresponding element.
Use like this:
Container | Type of associative container to convert to. |
key_sel | Selector used to extract keys for sequence elements. |
Container
mapping the source sequence's elements as specified. auto coveo::linq::to_associative | ( | const KeySelector & | key_sel, |
const ElementSelector & | elem_sel | ||
) | -> detail::to_associative_impl_2<Container, KeySelector, ElementSelector> |
Given a source sequence, returns a new associative container of the provided type that maps each element's key, as extracted by the provided key selector, to the corresponding mapped value, as extracted by the provided element selector.
Use like this:
Container | Type of associative container to convert to. |
key_sel | Selector used to extract keys for sequence elements. |
elem_sel | Selector used to extract mapped values for sequence elements. |
Container
mapping the source sequence's elements as specified. auto coveo::linq::to_map | ( | const KeySelector & | key_sel | ) | -> detail::to_map_impl_1<KeySelector> |
Given a source sequence, returns a new std::map
that maps each element's key, as extracted by the provided key selector, to the corresponding element. The map's type is auto-detected from the source sequence and selector.
Use like this:
key_sel | Selector used to extract keys for sequence elements. |
std::map
mapping the source sequence's elements as specified. auto coveo::linq::to_map | ( | const KeySelector & | key_sel, |
const ElementSelector & | elem_sel | ||
) | -> detail::to_map_impl_2<KeySelector, ElementSelector> |
Given a source sequence, returns a new std::map
that maps each element's key, as extracted by the provided key selector, to the corresponding mapped value, as extracted by the provided element selector. The map's type is auto-detected from the source sequence and selectors.
Use like this:
key_sel | Selector used to extract keys for sequence elements. |
elem_sel | Selector used to extract mapped values for sequence elements. |
std::map
mapping the source sequence's elements as specified.