]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2617] fix Wdeprecated-declarations warnings on std::iterator
authorAndrei Pavel <andrei@isc.org>
Tue, 6 Dec 2022 13:28:44 +0000 (15:28 +0200)
committerAndrei Pavel <andrei@isc.org>
Tue, 6 Dec 2022 13:28:44 +0000 (15:28 +0200)
Like this one:

../../../src/lib/dns/message.h:91:37: warning: â€˜template<class _Category, class _Tp, class _Distance, class _Pointer, class _Reference> struct std::iterator’ is deprecated [-Wdeprecated-declarations]
   91 | class SectionIterator : public std::iterator<std::input_iterator_tag, T> {
      |                                     ^~~~~~~~

src/lib/dns/message.h
src/lib/dns/rrset_collection_base.h
src/lib/util/encode/base_n.cc

index da8acfe64841a0f47e29bd7cacb6b3ff1f9903c0..410265d4896dad147087171b21cfc8b44837cfef 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2009-2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2009-2022 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -88,8 +88,15 @@ struct SectionIteratorImpl;
 /// The template parameter is either \c QuestionPtr (for the question section)
 /// or \c RRsetPtr (for the answer, authority, or additional section).
 template <typename T>
-class SectionIterator : public std::iterator<std::input_iterator_tag, T> {
+class SectionIterator {
 public:
+    // Aliases used to enable iterator behavior on this class
+    using iterator_category = std::input_iterator_tag;
+    using value_type = T;
+    using difference_type = std::ptrdiff_t;
+    using pointer = T*;
+    using reference = T&;
+
     SectionIterator() : impl_(NULL) {}
     SectionIterator(const SectionIteratorImpl<T>& impl);
     ~SectionIterator();
@@ -673,10 +680,8 @@ typedef boost::shared_ptr<const Message> ConstMessagePtr;
 /// \return A reference to the same \c std::ostream object referenced by
 /// parameter \c os after the insertion operation.
 std::ostream& operator<<(std::ostream& os, const Message& message);
-}
-}
-#endif  // MESSAGE_H
 
-// Local Variables:
-// mode: c++
-// End:
+}  // namespace dns
+}  // namespace isc
+
+#endif  // MESSAGE_H
index ac77756e417a7ecdc3af3443b7fe5ef7c91eaaf7..a8ca2551c62383ac4e84a2a62e5162cfce14bebc 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2012-2015,2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2022 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -153,10 +153,15 @@ public:
     ///
     /// It behaves like a \c std::iterator forward iterator, so please
     /// see its documentation for usage.
-    class Iterator : std::iterator<std::forward_iterator_tag,
-                                   const isc::dns::AbstractRRset>
-    {
+    class Iterator {
     public:
+        // Aliases used to enable iterator behavior on this class
+        using iterator_category = std::forward_iterator_tag;
+        using value_type = isc::dns::AbstractRRset const;
+        using difference_type = std::ptrdiff_t;
+        using pointer = isc::dns::AbstractRRset const*;
+        using reference = isc::dns::AbstractRRset const&;
+
         explicit Iterator(IterPtr iter) :
             iter_(iter)
         {}
@@ -207,7 +212,3 @@ typedef boost::shared_ptr<RRsetCollectionBase> RRsetCollectionPtr;
 } // end of namespace isc
 
 #endif  // RRSET_COLLECTION_BASE_H
-
-// Local Variables:
-// mode: c++
-// End:
index eb0eb2358f7a4c0c3b7372cdb385f8f989a9bfe3..e0c37e5f4933db176aace9e18cd24f6c370c57a3 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2010-2020 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2010-2022 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -112,8 +112,15 @@ const uint8_t BINARY_ZERO_CODE = 0;
 // Note: this class is intended to be used within this implementation file,
 // and assumes "base < base_end" on construction without validating the
 // arguments.  The behavior is undefined if this assumption doesn't hold.
-class EncodeNormalizer : public iterator<input_iterator_tag, uint8_t> {
+class EncodeNormalizer {
 public:
+    // Aliases used to enable iterator behavior on this class
+    using iterator_category = input_iterator_tag;
+    using value_type = uint8_t;
+    using difference_type = ptrdiff_t;
+    using pointer = uint8_t*;
+    using reference = uint8_t&;
+
     EncodeNormalizer(const vector<uint8_t>::const_iterator& base,
                      const vector<uint8_t>::const_iterator& base_end) :
         base_(base), base_end_(base_end), in_pad_(false)
@@ -167,8 +174,15 @@ private:
 // and for simplicity assumes "base < base_beginpad <= base_end" on
 // construction without validating the arguments.  The behavior is undefined
 // if this assumption doesn't hold.
-class DecodeNormalizer : public iterator<input_iterator_tag, char> {
+class DecodeNormalizer {
 public:
+    // Aliases used to enable iterator behavior on this class
+    using iterator_category = input_iterator_tag;
+    using value_type = char;
+    using difference_type = ptrdiff_t;
+    using pointer = char*;
+    using reference = char&;
+
     DecodeNormalizer(const char base_zero_code,
                      const string::const_iterator& base,
                      const string::const_iterator& base_beginpad,