From 2348e3a080b8cdc9e9d03478de2c346608ef6cc6 Mon Sep 17 00:00:00 2001 From: roker Date: Tue, 29 Jun 2021 17:24:27 +0200 Subject: [PATCH] inherit from std::iterator<> to add some typedefs that make GNU G++ happy. Unfortunately, std::iterator<> is deprecated in C++17, for whatever reason. :-/ --- src/wrapper.hh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/wrapper.hh b/src/wrapper.hh index d22d37b..287550c 100644 --- a/src/wrapper.hh +++ b/src/wrapper.hh @@ -5,6 +5,7 @@ #define LIBPEPDATATYPES_WRAPPER_HH #include +#include namespace pEp { @@ -129,14 +130,15 @@ public: static Element T::* const Value; // to access the current value // does not own the *value - class iterator + class iterator : public std::iterator< std::forward_iterator_tag, Element, ptrdiff_t> { public: + iterator() = default; - iterator operator++() { return (value ? value = value->next : value); } - Element operator*() { return value->*LW::Value; } - Element operator->() { return (value->*LW::Value); } + iterator operator++() { return (value ? value = value->next : value); } + Element operator*() { return value->*LW::Value; } + Element operator->() { return value->*LW::Value; } bool operator==(const iterator& other) const { return value == other.value; } bool operator!=(const iterator& other) const { return value != other.value; }