Browse Source

inherit from std::iterator<> to add some typedefs that make GNU G++ happy. Unfortunately, std::iterator<> is deprecated in C++17, for whatever reason. :-/

master
roker 4 months ago
parent
commit
2348e3a080
1 changed files with 6 additions and 4 deletions
  1. +6
    -4
      src/wrapper.hh

+ 6
- 4
src/wrapper.hh View File

@ -5,6 +5,7 @@
#define LIBPEPDATATYPES_WRAPPER_HH
#include <initializer_list>
#include <iterator>
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; }


Loading…
Cancel
Save