1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# HG changeset patch
# User Greg Smith
# Date 1513111541 -39600
# Node ID fd2f856b8d582df2e3e60073721a84b9f464a72b
# Parent 2286dd5fa6259c67cc8ce0d4c39b1c2e6f85ff1f
Use explicit typedefs instead of deprecated derivation from std::iterator.
This fixes a C4996 / STL4015 warning from Visual C++ 2017.5 that the
std::iterator class template is deprecated in C++17.
diff -r 2286dd5fa625 -r fd2f856b8d58 src/Document.cxx
--- a/src/Document.cxx Tue Nov 21 16:16:25 2017 +1100
+++ b/src/Document.cxx Wed Dec 13 07:45:41 2017 +1100
@@ -2600,8 +2600,14 @@
#ifndef NO_CXX11_REGEX
-class ByteIterator : public std::iterator<std::bidirectional_iterator_tag, char> {
+class ByteIterator {
public:
+ typedef std::bidirectional_iterator_tag iterator_category;
+ typedef char value_type;
+ typedef ptrdiff_t difference_type;
+ typedef char* pointer;
+ typedef char& reference;
+
const Document *doc;
Sci::Position position;
ByteIterator(const Document *doc_ = 0, Sci::Position position_ = 0) : doc(doc_), position(position_) {
@@ -2663,7 +2669,7 @@
// On Windows, report non-BMP characters as 2 separate surrogates as that
// matches wregex since it is based on wchar_t.
-class UTF8Iterator : public std::iterator<std::bidirectional_iterator_tag, wchar_t> {
+class UTF8Iterator {
// These 3 fields determine the iterator position and are used for comparisons
const Document *doc;
Sci::Position position;
@@ -2673,6 +2679,12 @@
size_t lenCharacters;
wchar_t buffered[2];
public:
+ typedef std::bidirectional_iterator_tag iterator_category;
+ typedef wchar_t value_type;
+ typedef ptrdiff_t difference_type;
+ typedef wchar_t* pointer;
+ typedef wchar_t& reference;
+
UTF8Iterator(const Document *doc_ = 0, Sci::Position position_ = 0) :
doc(doc_), position(position_), characterIndex(0), lenBytes(0), lenCharacters(0) {
buffered[0] = 0;
@@ -2775,10 +2787,16 @@
// On Unix, report non-BMP characters as single characters
-class UTF8Iterator : public std::iterator<std::bidirectional_iterator_tag, wchar_t> {
+class UTF8Iterator {
const Document *doc;
Sci::Position position;
public:
+ typedef std::bidirectional_iterator_tag iterator_category;
+ typedef wchar_t value_type;
+ typedef ptrdiff_t difference_type;
+ typedef wchar_t* pointer;
+ typedef wchar_t& reference;
+
UTF8Iterator(const Document *doc_=0, Sci::Position position_=0) : doc(doc_), position(position_) {
}
UTF8Iterator(const UTF8Iterator &other) NOEXCEPT {
|