coveo::linq
Implementation of .NET-like LINQ operators in C++
|
C++ implementation of .NET's IEnumerable-like data structure. More...
Go to the source code of this file.
Classes | |
class | coveo::enumerable< T > |
Type-erased sequence wrapper. More... | |
class | coveo::enumerable< T >::iterator |
Iterator for elements in the sequence. More... | |
Functions | |
template<typename U > | |
auto | coveo::enumerate_one (U &&obj) -> enumerable< typename seq_element_traits< U >::const_value_type > |
Returns enumerable over sequence of one element (stored internally). More... | |
template<typename T > | |
auto | coveo::enumerate_one_ref (T &obj) -> enumerable< T > |
Returns enumerable over sequence of one element (stored externally). More... | |
template<typename It > | |
auto | coveo::enumerate_range (It ibeg, It iend) -> enumerable< typename seq_element_traits< decltype(*std::declval< It >())>::value_type > |
Returns enumerable over sequence bound by iterators. More... | |
template<typename C > | |
auto | coveo::enumerate_container (C &cnt) -> enumerable< typename seq_element_traits< decltype(*std::begin(std::declval< C >()))>::value_type > |
Returns enumerable over container's sequence (stored externally). More... | |
template<typename C , typename = typename std::enable_if<!std::is_reference<C>::value, void>::type> | |
auto | coveo::enumerate_container (C &&cnt) -> enumerable< typename seq_element_traits< decltype(*std::begin(std::declval< C >()))>::const_value_type > |
Returns enumerable over container's sequence (stored internally). More... | |
template<typename T > | |
auto | coveo::enumerate_array (T *parr, size_t siz) -> enumerable< T > |
Returns enumerable over array's sequence. More... | |
This file contains the definition of coveo::enumerable
, which is a wrapper for a sequence similar to .NET's IEnumerable<T>
. Also includes helper methods and functions to create enumerable
s from single values, containers, etc.
auto coveo::enumerate_one | ( | U && | obj | ) | -> enumerable<typename seq_element_traits<U>::const_value_type> |
Returns a coveo::enumerable
over a sequence of one element. The enumerable
will store the element internally, moving it if possible.
The enumerable
's type is deduced from the type of the element.
obj | Object to store as the sequence's only element. |
enumerable
over sequence of one element. auto coveo::enumerate_one_ref | ( | T & | obj | ) | -> enumerable<T> |
Returns a coveo::enumerable
over a sequence of one element. The enumerable
will only store a reference to the element.
The enumerable
's type is deduced from the type of the element.
obj | Object to use as the sequence's only element. |
enumerable
over sequence of one element. auto coveo::enumerate_range | ( | It | ibeg, |
It | iend | ||
) | -> enumerable<typename seq_element_traits<decltype(*std::declval<It>())>::value_type> |
Returns a coveo::enumerable
over a sequence bound by two iterators.
The enumerable
's type is deduced from the type of element returned by the iterators.
ibeg | Iterator pointing at beginning of range. |
iend | Iterator pointing at end of range. |
enumerable
over sequence bound by [ibeg, iend[
. auto coveo::enumerate_container | ( | C & | cnt | ) | -> enumerable<typename seq_element_traits<decltype(*std::begin(std::declval<C>()))>::value_type> |
Returns a coveo::enumerable
over a sequence stored in a container. Only a reference to the container is kept by the enumerable
.
The enumerable
's type is deduced from the type of elements stored in the container.
cnt | Container whose elements to wrap. |
enumerable
over sequence of elements from cnt
. auto coveo::enumerate_container | ( | C && | cnt | ) | -> enumerable<typename seq_element_traits<decltype(*std::begin(std::declval<C>()))>::const_value_type> |
Returns a coveo::enumerable
over a sequence stored in a container. The container is moved to the enumerable
and stored internally.
The enumerable
's type is deduced from the type of elements stored in the container.
cnt | Container to store in the enumerable. |
enumerable
over sequence of elements from cnt
. auto coveo::enumerate_array | ( | T * | parr, |
size_t | siz | ||
) | -> enumerable<T> |
Returns a coveo::enumerable
over a sequence stored in a dynamic array. Equivalent to using coveo::enumerate_range()
without using pointer arithmetic.
The enumerable
's type is deduced from the type of elements stored in the array.
parr | Pointer to beginning of array. |
siz | Size of array. |
enumerable
over sequence in array.