[PATCH] D34223: [Support] Don't use std::iterator, it's deprecated in C++17

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 26 02:47:30 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL306230: [Support] Don't use std::iterator, it's deprecated in C++17. (authored by zturner).

Changed prior to commit:
  https://reviews.llvm.org/D34223?vs=102609&id=103903#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D34223

Files:
  llvm/trunk/include/llvm/Support/Path.h


Index: llvm/trunk/include/llvm/Support/Path.h
===================================================================
--- llvm/trunk/include/llvm/Support/Path.h
+++ llvm/trunk/include/llvm/Support/Path.h
@@ -17,6 +17,7 @@
 #define LLVM_SUPPORT_PATH_H
 
 #include "llvm/ADT/Twine.h"
+#include "llvm/ADT/iterator.h"
 #include "llvm/Support/DataTypes.h"
 #include <iterator>
 
@@ -49,7 +50,8 @@
 ///   C:\foo\bar => C:,/,foo,bar
 /// @endcode
 class const_iterator
-    : public std::iterator<std::input_iterator_tag, const StringRef> {
+    : public iterator_facade_base<const_iterator, std::input_iterator_tag,
+                                  const StringRef> {
   StringRef Path;      ///< The entire path.
   StringRef Component; ///< The current component. Not necessarily in Path.
   size_t    Position;  ///< The iterators current position within Path.
@@ -61,10 +63,8 @@
 
 public:
   reference operator*() const { return Component; }
-  pointer   operator->() const { return &Component; }
   const_iterator &operator++();    // preincrement
   bool operator==(const const_iterator &RHS) const;
-  bool operator!=(const const_iterator &RHS) const { return !(*this == RHS); }
 
   /// @brief Difference in bytes between this and RHS.
   ptrdiff_t operator-(const const_iterator &RHS) const;
@@ -76,7 +76,8 @@
 /// \a path in reverse order. The traversal order is exactly reversed from that
 /// of \a const_iterator
 class reverse_iterator
-    : public std::iterator<std::input_iterator_tag, const StringRef> {
+    : public iterator_facade_base<reverse_iterator, std::input_iterator_tag,
+                                  const StringRef> {
   StringRef Path;      ///< The entire path.
   StringRef Component; ///< The current component. Not necessarily in Path.
   size_t    Position;  ///< The iterators current position within Path.
@@ -87,10 +88,8 @@
 
 public:
   reference operator*() const { return Component; }
-  pointer   operator->() const { return &Component; }
   reverse_iterator &operator++();    // preincrement
   bool operator==(const reverse_iterator &RHS) const;
-  bool operator!=(const reverse_iterator &RHS) const { return !(*this == RHS); }
 
   /// @brief Difference in bytes between this and RHS.
   ptrdiff_t operator-(const reverse_iterator &RHS) const;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34223.103903.patch
Type: text/x-patch
Size: 2289 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170626/0ae8ef92/attachment.bin>


More information about the llvm-commits mailing list