[PATCH] D145025: [ADT] Clean up `enumerate` implementation. NFC.

Jakub Kuderski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 2 13:45:20 PST 2023


This revision was automatically updated to reflect the committed changes.
kuhar marked an inline comment as done.
Closed by commit rGf254acf571a7: [ADT] Clean up `enumerate` implementation. NFC. (authored by kuhar).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145025

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
@@ -2197,18 +2197,9 @@
 
   friend class enumerator_iter<R>;
 
-  result_pair() = default;
   result_pair(std::size_t Index, IterOfRange<R> Iter)
       : Index(Index), Iter(Iter) {}
 
-  result_pair(const result_pair<R> &Other)
-      : Index(Other.Index), Iter(Other.Iter) {}
-  result_pair &operator=(const result_pair &Other) {
-    Index = Other.Index;
-    Iter = Other.Iter;
-    return *this;
-  }
-
   std::size_t index() const { return Index; }
   value_reference value() const { return *Iter; }
 
@@ -2256,12 +2247,6 @@
     return Result.Iter == RHS.Result.Iter;
   }
 
-  enumerator_iter(const enumerator_iter &Other) : Result(Other.Result) {}
-  enumerator_iter &operator=(const enumerator_iter &Other) {
-    Result = Other.Result;
-    return *this;
-  }
-
 private:
   result_type Result;
 };
@@ -2294,13 +2279,13 @@
 ///
 /// std::vector<char> Items = {'A', 'B', 'C', 'D'};
 /// for (auto X : enumerate(Items)) {
-///   printf("Item %d - %c\n", X.index(), X.value());
+///   printf("Item %zu - %c\n", X.index(), X.value());
 /// }
 ///
 /// or using structured bindings:
 ///
 /// for (auto [Index, Value] : enumerate(Items)) {
-///   printf("Item %d - %c\n", Index, Value);
+///   printf("Item %zu - %c\n", Index, Value);
 /// }
 ///
 /// Output:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145025.501967.patch
Type: text/x-patch
Size: 1451 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230302/651cc5a5/attachment.bin>


More information about the llvm-commits mailing list