llvm::reverse_conditionally

Return a range that conditionally reverses C.

Synopsis

Declared in <llvm/ADT/STLExtras.h>

template<typename ContainerTy>
[[nodiscard]]
auto
reverse_conditionally(
    ContainerTy&& C,
    bool ShouldReverse);

Description

The collection is iterated in reverse if ShouldReverse is true (otherwise, it is iterated forwards).

Return Value

A range over C, optionally reversed.

NOTE

The return value should not be discarded.

Parameters

NameDescription
CContainer or range to view.
ShouldReverseWhether to iterate in reverse order.