diff options
author | Greg Smith <unknown> | 2017-12-13 07:45:41 +1100 |
---|---|---|
committer | Greg Smith <unknown> | 2017-12-13 07:45:41 +1100 |
commit | d465c733ef5530a207ba44ef77be12cc3a355782 (patch) | |
tree | e6e00d865c6f5718a7db31c186a5c9adceedc352 | |
parent | 938b8000fd6fca9595fe3eb00f5e5684b13bd721 (diff) | |
download | scintilla-mirror-d465c733ef5530a207ba44ef77be12cc3a355782.tar.gz |
Backport: 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.
Backport of changeset 6421:fd2f856b8d58.
-rw-r--r-- | src/Document.cxx | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/Document.cxx b/src/Document.cxx index 593234907..90dfb52bc 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -2604,8 +2604,14 @@ public: #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_) { @@ -2667,7 +2673,7 @@ public: // 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; @@ -2677,6 +2683,12 @@ class UTF8Iterator : public std::iterator<std::bidirectional_iterator_tag, wchar 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; @@ -2779,10 +2791,16 @@ private: // 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 { |