HomePhabricator

Reapply "Add reverse(ContainerTy) range adapter."

Description

Reapply "Add reverse(ContainerTy) range adapter."

This reverts commit r243567, which ultimately reapplies r243563.

The fix here was to use std::enable_if for overload resolution. Thanks to David
Blaikie for lots of help on this, and for the extra tests!

Original commit message follows:

For cases where we needed a foreach loop in reverse over a container,
we had to do something like

for (const GlobalValue *GV : make_range(TypeInfos.rbegin(),

TypeInfos.rend())) {

This provides a convenience method which shortens this to

for (const GlobalValue *GV : reverse(TypeInfos)) {

There are 2 versions of this, with a preference to the rbegin() version.

The first uses rbegin() and rend() to construct an iterator_range.

The second constructs an iterator_range from the begin() and end() methods
wrapped in std::reverse_iterator's.

Reviewed by David Blaikie.

Details

Committed
peteJul 29 2015, 3:19 PM
Parents
rL243580: Make DWARF at_comp_dir symbolic links configurable via plugin.symbol-file.
Branches
Unknown
Tags
Unknown