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

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 20 22:42:00 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rGfc9aa33def00: Use std::iterator_traits to infer result type of llvm::enumerate iterator… (authored by mehdi_amini).

Changed prior to commit:
  https://reviews.llvm.org/D63632?vs=205923&id=205941#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63632

Files:
  llvm/include/llvm/ADT/STLExtras.h


Index: llvm/include/llvm/ADT/STLExtras.h
===================================================================
--- llvm/include/llvm/ADT/STLExtras.h
+++ llvm/include/llvm/ADT/STLExtras.h
@@ -1506,6 +1506,9 @@
 template <typename R> class enumerator_iter;
 
 template <typename R> struct result_pair {
+  using value_reference =
+      typename std::iterator_traits<IterOfRange<R>>::reference;
+
   friend class enumerator_iter<R>;
 
   result_pair() = default;
@@ -1519,8 +1522,8 @@
   }
 
   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; }
 
 private:
   std::size_t Index = std::numeric_limits<std::size_t>::max();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63632.205941.patch
Type: text/x-patch
Size: 817 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190621/9f9938f3/attachment.bin>


More information about the llvm-commits mailing list