summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2023-11-05 20:05:27 +0100
committerMoonchild <moonchild@palemoon.org>2023-11-05 20:05:27 +0100
commit087aa28bc7bc81e2b2aebafd1189f37ae1943d22 (patch)
tree35559f2c7b33aeffc5bc29f7b95cfb12c95afbe0
parent05abfd8200c56d52f74ca4ebdca4d1536d376fdd (diff)
downloaduxp-087aa28bc7bc81e2b2aebafd1189f37ae1943d22.tar.gz
Issue #2281 - Patch out google protobuf inheritance from std::iterator
Updating Iterators to be compatible with C++17 The std::iterator class is being deprecated on MSVC++, and currently if the compilation flag /std:c++latest is used a warning is issued in this regard if any iterators use the class as a base class. If an external source file being compiled includes the repeated_field.h header, the iterator clases RepeatedPtrIterator and RepeatedPtrOverPtrsIterator trigger the warning. This change solves the warning and should avoid it in the future when the default is to remove the class. See https://github.com/protocolbuffers/protobuf/commit/2949ebd842e25c1bcb8b63b377a454a0887ea5a2
-rw-r--r--toolkit/components/protobuf/src/google/protobuf/repeated_field.h41
1 files changed, 12 insertions, 29 deletions
diff --git a/toolkit/components/protobuf/src/google/protobuf/repeated_field.h b/toolkit/components/protobuf/src/google/protobuf/repeated_field.h
index 50051831d6..29fe823360 100644
--- a/toolkit/components/protobuf/src/google/protobuf/repeated_field.h
+++ b/toolkit/components/protobuf/src/google/protobuf/repeated_field.h
@@ -1250,23 +1250,14 @@ namespace internal {
// This code based on net/proto/proto-array-internal.h by Jeffrey Yasskin
// (jyasskin@google.com).
template<typename Element>
-class RepeatedPtrIterator
- : public std::iterator<
- std::random_access_iterator_tag, Element> {
+class RepeatedPtrIterator {
public:
typedef RepeatedPtrIterator<Element> iterator;
- typedef std::iterator<
- std::random_access_iterator_tag, Element> superclass;
-
- // Shadow the value_type in std::iterator<> because const_iterator::value_type
- // needs to be T, not const T.
- typedef typename remove_const<Element>::type value_type;
-
- // Let the compiler know that these are type names, so we don't have to
- // write "typename" in front of them everywhere.
- typedef typename superclass::reference reference;
- typedef typename superclass::pointer pointer;
- typedef typename superclass::difference_type difference_type;
+ typedef std::random_access_iterator_tag iterator_category;
+ typedef Element value_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef Element* pointer;
+ typedef Element& reference;
RepeatedPtrIterator() : it_(NULL) {}
explicit RepeatedPtrIterator(void* const* it) : it_(it) {}
@@ -1346,22 +1337,14 @@ class RepeatedPtrIterator
// referenced by the iterator. It should either be "void *" for a mutable
// iterator, or "const void *" for a constant iterator.
template<typename Element, typename VoidPtr>
-class RepeatedPtrOverPtrsIterator
- : public std::iterator<std::random_access_iterator_tag, Element*> {
+class RepeatedPtrOverPtrsIterator {
public:
typedef RepeatedPtrOverPtrsIterator<Element, VoidPtr> iterator;
- typedef std::iterator<
- std::random_access_iterator_tag, Element*> superclass;
-
- // Shadow the value_type in std::iterator<> because const_iterator::value_type
- // needs to be T, not const T.
- typedef typename remove_const<Element*>::type value_type;
-
- // Let the compiler know that these are type names, so we don't have to
- // write "typename" in front of them everywhere.
- typedef typename superclass::reference reference;
- typedef typename superclass::pointer pointer;
- typedef typename superclass::difference_type difference_type;
+ typedef std::random_access_iterator_tag iterator_category;
+ typedef Element value_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef Element* pointer;
+ typedef Element& reference;
RepeatedPtrOverPtrsIterator() : it_(NULL) {}
explicit RepeatedPtrOverPtrsIterator(VoidPtr* it) : it_(it) {}