Example #1
0
File: main.cpp Project: CCJY/coliru
auto diffs(BidiRange&& in)
{
    using std::next;
    using std::prev;
    using boost::begin;
    using boost::end;
    using boost::empty;
    using boost::get;
    assert( !empty(in) );
    auto offset = [](auto&& in) { return boost::make_iterator_range(std::next(begin(in)), end(in)); };
    auto shave = [](auto&& in) { return boost::make_iterator_range(begin(in), std::prev(end(in))); };
    return R::transform(range::combine(R::stride(shave(in), 2), R::stride(offset(in), 2))
                        , [](auto const& elems) { return get<0>(elems) < get<1>(elems); } );
}