From: Kefu Chai Date: Sat, 10 Oct 2020 12:56:21 +0000 (+0800) Subject: include/interval_set: do not inherit from std::iterator X-Git-Tag: v16.1.0~854^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=af3be4b7252873f57abab1aa421604684fa33bce;p=ceph.git include/interval_set: do not inherit from std::iterator std::iterator is deprecated in C++17, so drop it. Signed-off-by: Kefu Chai --- diff --git a/src/include/interval_set.h b/src/include/interval_set.h index 7b2d994387f2b..2b6ba05d709c6 100644 --- a/src/include/interval_set.h +++ b/src/include/interval_set.h @@ -113,9 +113,15 @@ class interval_set { friend class interval_set; }; - class const_iterator : public std::iterator + 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; }