From c3019779ff0a58979e5936519b30f313205d10aa Mon Sep 17 00:00:00 2001 From: Richard Kreckel Date: Wed, 10 Aug 2022 00:35:22 +0200 Subject: [PATCH] [C++17] Don't inherit from std::iterator... ...because this has been deprecated. See LWG2438. --- ginac/ex.h | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/ginac/ex.h b/ginac/ex.h index 861bf730..555de306 100644 --- a/ginac/ex.h +++ b/ginac/ex.h @@ -367,12 +367,17 @@ bool ex::is_equal(const ex & other) const // Iterators -class const_iterator : public std::iterator { +class const_iterator { friend class ex; friend class const_preorder_iterator; friend class const_postorder_iterator; - public: + using iterator_category = std::random_access_iterator_tag; + using value_type = ex; + using difference_type = ptrdiff_t; + using pointer = const ex *; + using reference = const ex &; + const_iterator() noexcept {} private: @@ -513,8 +518,13 @@ struct _iter_rep { } // namespace internal -class const_preorder_iterator : public std::iterator { +class const_preorder_iterator { public: + using iterator_category = std::forward_iterator_tag; + using value_type = ex; + using difference_type = ptrdiff_t; + using pointer = const ex *; + using reference = const ex &; const_preorder_iterator() noexcept {} const_preorder_iterator(const ex &e, size_t n) @@ -577,8 +587,13 @@ private: } }; -class const_postorder_iterator : public std::iterator { +class const_postorder_iterator { public: + using iterator_category = std::forward_iterator_tag; + using value_type = ex; + using difference_type = ptrdiff_t; + using pointer = const ex *; + using reference = const ex &; const_postorder_iterator() noexcept {} const_postorder_iterator(const ex &e, size_t n) -- 2.49.0