coveo::linq
Implementation of .NET-like LINQ operators in C++
|
Filters out duplicate elements in a sequence. More...
Functions | |
template<typename = void> | |
auto | coveo::linq::distinct () -> detail::distinct_impl< detail::less<>> |
Filters out duplicate elements in sequence. More... | |
template<typename Pred > | |
auto | coveo::linq::distinct (Pred &&pred) -> detail::distinct_impl< Pred > |
Filters out duplicate elements in sequence using predicate. More... | |
The distinct
operator filters out duplicate elements in a sequence. Unique elements are returned in the same order they appear in the source sequence.
.NET equivalent: Distinct
auto coveo::linq::distinct | ( | ) | -> detail::distinct_impl<detail::less<>> |
Filters out duplicate elements in a sequence, returning the unique elements in the same order they appear in the source sequence.
To filter out duplicates, elements are sorted using operator<()
.
Use like this:
auto coveo::linq::distinct | ( | Pred && | pred | ) | -> detail::distinct_impl<Pred> |
Filters out duplicate elements in a sequence, returning the unique elements in the same order they appear in the source sequence.
To filter out duplicates, the provided predicate is used to sort the elements. The predicate must provide a strict ordering of the elements, like std::less
.
Use like this:
pred | Predicate used to order the elements in order to remove the duplicates. |