This is an archive of the discontinued LLVM Phabricator instance.

Make STLExtras range adapters consistent.
ClosedPublic

Authored by zturner on Nov 22 2016, 3:50 PM.

Details

Summary
  1. Use std::begin() / std::end() instead of Range.begin() / Range.end(). Might as well allow these functions to work on C-arrays.
  2. use typename everywhere instead of class.
  3. Always pass predicates by value.

Diff Detail

Event Timeline

zturner updated this revision to Diff 78969.Nov 22 2016, 3:50 PM
zturner retitled this revision from to Make STLExtras range adapters consistent..
zturner updated this object.
zturner added a reviewer: chandlerc.
zturner added a subscriber: llvm-commits.
chandlerc accepted this revision.Nov 22 2016, 4:11 PM
chandlerc edited edge metadata.

I was going to suggest fancy schmancy ADL stuff for std::begin as well, but I dunno that it is worth it. We can add an ADL based dispatcher if anyone comes up with a container that wants it.

LGTM with a nit below.

include/llvm/ADT/STLExtras.h
573–574

Here and below the I previously was an iterator. I'd use V as the variable here?

This revision is now accepted and ready to land.Nov 22 2016, 4:11 PM
This revision was automatically updated to reflect the committed changes.