rangeless::fn
Inputs and Outputs

Namespaces

 rangeless::fn::impl
 Implementations for corresponding static functions in fn::
 

Classes

struct  rangeless::fn::end_seq
 Return fn::end_seq() from input-range generator function to signal end-of-inputs. More...
 

Functions

template<typename NullaryInvokable >
impl::seq< impl::catch_end< NullaryInvokable > > rangeless::fn::seq (NullaryInvokable gen_fn)
 Adapt a generator function as InputRange. More...
 
template<typename Iterable >
impl::seq< impl::refs_gen< Iterable > > rangeless::fn::refs (Iterable &src)
 Adapt a reference to Iterable as seq yielding reference-wrappers. More...
 

Detailed Description

Function Documentation

◆ refs()

template<typename Iterable >
impl::seq<impl::refs_gen<Iterable> > rangeless::fn::refs ( Iterable &  src)

Adapt a reference to Iterable as seq yielding reference-wrappers.

Definition at line 687 of file fn.hpp.

◆ seq()

template<typename NullaryInvokable >
impl::seq<impl::catch_end<NullaryInvokable> > rangeless::fn::seq ( NullaryInvokable  gen_fn)

Adapt a generator function as InputRange.

int i = 0;
int sum =
fn::seq([&i]
{
return i < 5 ? x++ : fn::end_seq();
})
% fn::where([](int x)
{
return x > 2;
}) // 3, 4
% fn::transform([](int x)
{
return x + 1;
}) // 4, 5
% fn::foldl_d([](int out, int in)
{
return out * 10 + in;
});
VERIFY(sum == 45);

Definition at line 677 of file fn.hpp.