Use std::iterator_traits to infer result type of llvm::enumerate iterator wrapper
authorMehdi Amini <joker.eph@gmail.com>
Fri, 21 Jun 2019 05:43:08 +0000 (05:43 +0000)
committerMehdi Amini <joker.eph@gmail.com>
Fri, 21 Jun 2019 05:43:08 +0000 (05:43 +0000)
commitb1a1e51aaebf3b89f4589946cbb708700ba1fcb3
treec22499425ce42b3a5050e6994e6f23320cc48250
parent32e092ad46bb527debb97a6b5bc683bd543b88a7
Use std::iterator_traits to infer result type of llvm::enumerate iterator wrapper

Update the llvm::enumerate helper class result_pair<R> to use the 'iterator_traits<R>::reference'
type as the result of 'value()' instead 'ValueOfRange<R> &'. This enables support for iterators
that return value types, i.e. non reference. This is a common pattern for some classes of
iterators, e.g. mapped_iterator.

Patch by: River Riddle <riverriddle@google.com>

Differential Revision: https://reviews.llvm.org/D63632

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364007 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/ADT/STLExtras.h