]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
include/interval_set: do not inherit from std::iterator 37626/head
authorKefu Chai <kchai@redhat.com>
Sat, 10 Oct 2020 12:56:21 +0000 (20:56 +0800)
committerKefu Chai <kchai@redhat.com>
Sat, 10 Oct 2020 12:58:04 +0000 (20:58 +0800)
std::iterator is deprecated in C++17, so drop it.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/include/interval_set.h

index 7b2d994387f2b74efda90966454e0976c19e2a77..2b6ba05d709c6c96001b4ee2e4a264e302f935dc 100644 (file)
@@ -113,9 +113,15 @@ class interval_set {
     friend class interval_set;
   };
 
-  class const_iterator : public std::iterator <std::forward_iterator_tag, T>
+  class const_iterator
   {
     public:
+        using difference_type = ssize_t;
+        using value_type = const typename Map::value_type;
+        using pointer = const typename Map::value_type*;
+        using reference = const typename Map::value_type&;
+        using iterator_category = std::forward_iterator_tag;
+
         explicit const_iterator(typename Map::const_iterator iter)
           : _iter(iter)
         { }
@@ -136,7 +142,7 @@ class interval_set {
         }
 
         // Dereference this iterator to get a pair.
-        const_reference operator*() const {
+        reference operator*() const {
           return *_iter;
         }