[PATCH] D63632: Update the llvm::enumerate utility class result_pair to use the 'iterator_traits<R>::reference' instead of 'ValueOfIter<R> &'.

Nicolas Guillemot via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 16 19:25:24 PDT 2021


nlguillemot added inline comments.
Herald added a reviewer: bollu.


================
Comment at: llvm/include/llvm/ADT/STLExtras.h:1525
   std::size_t index() const { return Index; }
-  const ValueOfRange<R> &value() const { return *Iter; }
-  ValueOfRange<R> &value() { return *Iter; }
+  const value_reference value() const { return *Iter; }
+  value_reference value() { return *Iter; }
----------------
I think this doesn't match the previous behavior.

I think `const value_reference` is like `T & const`, not like `const T &`.

I wish I could suggest using a typedef like `const_value_reference = (...)::const_reference` and returning that, but `iterator_traits` doesn't have such a member typedef.

Found this due to a compile error in some downstream code.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63632/new/

https://reviews.llvm.org/D63632



More information about the llvm-commits mailing list