template<typename T, typename U>
impl-dfn-deferred-range range(T start, U end);

Creates a deferred range whose first element is start and past-the-last element is end.

Parameters

  • start - the first element of the range.
  • end - the past-the-last element of the range.

Each consecutive element is computed as:

int next = current + 1; //initially current is start.

Return

A deferred-range.

Example

#include <iostream>
#include <vector>
#include <foam/composition/pipeline.h>

int main()
{
    using namespace foam::composition;

    auto numbers = range(2, 13);

    for(int i : numbers)
        std::cout << i << " ";
}

Output

2 3 4 5 6 7 8 9 10 11 12

Other pipes