coveo::linq
Implementation of .NET-like LINQ operators in C++
Functions
LINQ expression entry points

Functions to start a LINQ expression. More...

Functions

template<typename Seq >
auto coveo::linq::from (Seq &&seq) -> decltype(std::forward< Seq >(seq))
 Standard LINQ expression entry point. More...
 
template<typename It >
auto coveo::linq::from_range (It ibeg, It iend) -> decltype(enumerate_range(std::move(ibeg), std::move(iend)))
 LINQ expression entry point from iterators. More...
 
template<typename IntT >
auto coveo::linq::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. More...
 
template<typename T >
auto coveo::linq::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. More...
 

Detailed Description

An "entry point" is a function that provides the initial sequence on which to apply LINQ operators. It also provides a nice look to the expression, a bit like a database query.

The usual entry point for a LINQ expression is coveo::linq::from(), which simply returns the sequence passed in. Other entry points generate a sequence for use in the expression.

Function Documentation

◆ from()

template<typename Seq >
auto coveo::linq::from ( Seq &&  seq) -> decltype(std::forward<Seq>(seq))

Standard entry point for a LINQ expression. Specifies the initial sequence on which the first operator will be applied. After this, use coveo::linq::operator|() to chain LINQ operators and apply them in a specific order (see chaining).

Use like this:

using namespace coveo::linq;
auto result = from(some_sequence)
| linq_operator(...)
| ...;

◆ from_range()

template<typename It >
auto coveo::linq::from_range ( It  ibeg,
It  iend 
) -> decltype(enumerate_range(std::move(ibeg), std::move(iend)))

Entry point for a LINQ expression that produces a sequence of elements delimited by two iterators. After this, use coveo::linq::operator|() to chain LINQ operators and apply them in a specific order (see chaining).

Use like this:

using namespace coveo::linq;
auto result = from_range(something.begin(), something.end())
| linq_operator(...)
| ...;
See also
coveo::enumerate_range()

◆ from_int_range()

template<typename IntT >
auto coveo::linq::from_int_range ( IntT  first,
std::size_t  count 
) -> coveo::enumerable<const typename std::decay<IntT>::type>

Entry point for a LINQ expression that produces a sequence of incrementing numbers from a starting point. After this, use coveo::linq::operator|() to chain LINQ operators and apply them in a specific order (see chaining).

Use like this:

using namespace coveo::linq;
auto result = from_int_range(1, 10) // 1, 2, 3...
| linq_operator(...)
| ...;

◆ from_repeated()

template<typename T >
auto coveo::linq::from_repeated ( const T &  value,
std::size_t  count 
) -> coveo::enumerable<const typename std::decay<T>::type>

Entry point for a LINQ expression that produces a sequence created by repeating a given value multiple times.. After this, use coveo::linq::operator|() to chain LINQ operators and apply them in a specific order (see chaining).

Use like this:

using namespace coveo::linq;
auto result = from_repeated(std::string("Life"), 7) // "Life", "Life", "Life"...
| linq_operator(...)
| ...;