Skip to content

Commit 4f76930

Browse files
Stop using std::iterator
Fixes eng/fuzz/symcc#10.
1 parent d1d62fc commit 4f76930

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

runtime/Shadow.h

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include <algorithm>
2020
#include <cassert>
2121
#include <cstring>
22-
#include <iterator>
2322
#include <map>
2423

2524
#include <Runtime.h>
@@ -59,12 +58,21 @@ extern std::map<uintptr_t, SymExpr *> g_shadow_pages;
5958
/// An iterator that walks over the shadow bytes corresponding to a memory
6059
/// region. If there is no shadow for any given memory address, it just returns
6160
/// null.
62-
class ReadShadowIterator
63-
: public std::iterator<std::bidirectional_iterator_tag, SymExpr> {
61+
class ReadShadowIterator {
6462
public:
6563
explicit ReadShadowIterator(uintptr_t address)
66-
: std::iterator<std::bidirectional_iterator_tag, SymExpr>(),
67-
address_(address), shadow_(getShadow(address)) {}
64+
: address_(address), shadow_(getShadow(address)) {}
65+
66+
// The STL requires iterator types to expose the following type definitions
67+
// (see std::iterator_traits). Before C++17, it was possible to get them by
68+
// deriving from std::iterator, which is just an empty template struct with
69+
// five typedefs. However, std::iterator was deprecated in C++17 and hence its
70+
// use causes a warning in recent compilers.
71+
using iterator_category = std::bidirectional_iterator_tag;
72+
using value_type = SymExpr;
73+
using difference_type = ptrdiff_t;
74+
using pointer = SymExpr *;
75+
using reference = SymExpr &;
6876

6977
ReadShadowIterator &operator++() {
7078
auto previousAddress = address_++;

0 commit comments

Comments
 (0)