From cc5a4e85ae0f0e21c9c1aa7c17a1d19dc59b18c8 Mon Sep 17 00:00:00 2001 From: Daniela Engert Date: Mon, 18 Dec 2017 19:15:52 +0100 Subject: [PATCH] Inheriting std::iterator is deprecated in c++17. Therefore replace the inheritance by lifting std::iterator's members into the derived class. Fortunately, this is already done in Boost.Regex so that dropping the inheritance is a no-brainer. Signed-off-by: Daniela Engert --- example/timer/regex_timer.cpp | 6 ------ include/boost/regex/v4/fileiter.hpp | 3 --- include/boost/regex/v4/regex_format.hpp | 5 ----- include/boost/regex/v4/regex_iterator.hpp | 8 -------- include/boost/regex/v4/regex_token_iterator.hpp | 8 -------- include/boost/regex/v4/u32regex_iterator.hpp | 8 -------- include/boost/regex/v4/u32regex_token_iterator.hpp | 8 -------- test/regress/test_icu.cpp | 8 ++++---- 8 files changed, 4 insertions(+), 50 deletions(-) diff --git a/example/timer/regex_timer.cpp b/example/timer/regex_timer.cpp index ad47dcee..48f41a9b 100644 --- a/example/timer/regex_timer.cpp +++ b/example/timer/regex_timer.cpp @@ -67,11 +67,7 @@ ostream& operator << (ostream& os, const std::wstring& s) template class string_out_iterator -#ifndef BOOST_NO_STD_ITERATOR - : public std::iterator -#endif // ndef BOOST_NO_STD_ITERATOR { -#ifdef BOOST_NO_STD_ITERATOR public: typedef std::output_iterator_tag iterator_category; typedef void value_type; @@ -79,8 +75,6 @@ public: typedef void pointer; typedef void reference; private: -#endif // BOOST_NO_STD_ITERATOR - S* out; public: string_out_iterator(S& s) : out(&s) {} diff --git a/include/boost/regex/v4/fileiter.hpp b/include/boost/regex/v4/fileiter.hpp index 256a7e46..7c865c63 100644 --- a/include/boost/regex/v4/fileiter.hpp +++ b/include/boost/regex/v4/fileiter.hpp @@ -195,9 +195,6 @@ public: }; class BOOST_REGEX_DECL mapfile_iterator -#if !defined(BOOST_NO_STD_ITERATOR) || defined(BOOST_MSVC_STD_ITERATOR) -: public std::iterator -#endif { typedef mapfile::pointer internal_pointer; internal_pointer* node; diff --git a/include/boost/regex/v4/regex_format.hpp b/include/boost/regex/v4/regex_format.hpp index f0a0a11e..b65ffcc9 100644 --- a/include/boost/regex/v4/regex_format.hpp +++ b/include/boost/regex/v4/regex_format.hpp @@ -800,9 +800,6 @@ void basic_regex_formatter::put(co template class string_out_iterator -#ifndef BOOST_NO_STD_ITERATOR - : public std::iterator -#endif { S* out; public: @@ -816,13 +813,11 @@ public: return *this; } -#ifdef BOOST_NO_STD_ITERATOR typedef std::ptrdiff_t difference_type; typedef typename S::value_type value_type; typedef value_type* pointer; typedef value_type& reference; typedef std::output_iterator_tag iterator_category; -#endif }; template diff --git a/include/boost/regex/v4/regex_iterator.hpp b/include/boost/regex/v4/regex_iterator.hpp index 0d10a1b9..380a9a71 100644 --- a/include/boost/regex/v4/regex_iterator.hpp +++ b/include/boost/regex/v4/regex_iterator.hpp @@ -85,14 +85,6 @@ template ::value_type, class traits = regex_traits > class regex_iterator -#ifndef BOOST_NO_STD_ITERATOR - : public std::iterator< - std::forward_iterator_tag, - match_results, - typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::difference_type, - const match_results*, - const match_results& > -#endif { private: typedef regex_iterator_implementation impl; diff --git a/include/boost/regex/v4/regex_token_iterator.hpp b/include/boost/regex/v4/regex_token_iterator.hpp index 1d75604b..fde51d74 100644 --- a/include/boost/regex/v4/regex_token_iterator.hpp +++ b/include/boost/regex/v4/regex_token_iterator.hpp @@ -167,14 +167,6 @@ template ::value_type, class traits = regex_traits > class regex_token_iterator -#ifndef BOOST_NO_STD_ITERATOR - : public std::iterator< - std::forward_iterator_tag, - sub_match, - typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::difference_type, - const sub_match*, - const sub_match& > -#endif { private: typedef regex_token_iterator_implementation impl; diff --git a/include/boost/regex/v4/u32regex_iterator.hpp b/include/boost/regex/v4/u32regex_iterator.hpp index 701ef3d8..df697521 100644 --- a/include/boost/regex/v4/u32regex_iterator.hpp +++ b/include/boost/regex/v4/u32regex_iterator.hpp @@ -72,14 +72,6 @@ private: template class u32regex_iterator -#ifndef BOOST_NO_STD_ITERATOR - : public std::iterator< - std::forward_iterator_tag, - match_results, - typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::difference_type, - const match_results*, - const match_results& > -#endif { private: typedef u32regex_iterator_implementation impl; diff --git a/include/boost/regex/v4/u32regex_token_iterator.hpp b/include/boost/regex/v4/u32regex_token_iterator.hpp index 9eabbe48..a056102c 100644 --- a/include/boost/regex/v4/u32regex_token_iterator.hpp +++ b/include/boost/regex/v4/u32regex_token_iterator.hpp @@ -155,14 +155,6 @@ private: template class u32regex_token_iterator -#ifndef BOOST_NO_STD_ITERATOR - : public std::iterator< - std::forward_iterator_tag, - sub_match, - typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits::difference_type, - const sub_match*, - const sub_match& > -#endif { private: typedef u32regex_token_iterator_implementation impl; diff --git a/test/regress/test_icu.cpp b/test/regress/test_icu.cpp index 67044f0e..1ef9fa96 100644 --- a/test/regress/test_icu.cpp +++ b/test/regress/test_icu.cpp @@ -33,16 +33,16 @@ namespace unnecessary_fix{ // template class back_insert_iterator -#ifndef BOOST_NO_STD_ITERATOR - : public std::iterator -#endif { private: Seq* container; public: typedef const typename Seq::value_type value_type; typedef Seq container_type; - typedef std::output_iterator_tag iterator_category; + typedef void difference_type; + typedef void pointer; + typedef void reference; + typedef std::output_iterator_tag iterator_category; explicit back_insert_iterator(Seq& x) : container(&x) {} back_insert_iterator& operator=(const value_type& val)