Reverseļƒ

Include <mln/core/ranges/view/reverse.hpp>

auto view::reverse(ReversibleRange r)ļƒ
Parameters:

r ā€“ Input range

If the expression r.reversed() is valid, then it is returned. Otherwise, r must model the concept BidirectionalRange and the function returns ::ranges::view::reverse(rng). This view preserves the following properties:

Properties

r

reverse(r)

Segmented

X

X

Forward

X

X

Reversible

X

X

Bidirectional

X

X

Random Access

X

X

Contiguous

X

X

Writable

X

X

Examples

  • Browse a box2dā€™s indexes reversly:

    mln::box2d box = {{0,0}, {2,3}};
    mln_foreach(auto p, ranges::view::reverse(box))
      std::cout << p << ",";
    

    Outputs:

    (1,2),(1,1),(1,0),(0,2),(0,1),(0,0),