From af3be4b7252873f57abab1aa421604684fa33bce Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sat, 10 Oct 2020 20:56:21 +0800 Subject: [PATCH] include/interval_set: do not inherit from std::iterator std::iterator is deprecated in C++17, so drop it. Signed-off-by: Kefu Chai --- src/include/interval_set.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/include/interval_set.h b/src/include/interval_set.h index 7b2d994387f2..2b6ba05d709c 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; } -- 2.47.3