diff --git a/CHANGES b/CHANGES index 268a804..81c8b67 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,6 @@ -Version 3.3.1-dev ------------------ +Version 3.3.1 [12 Sep 2023] +--------------------------- +- Stop using the std::iterator deprecated in C++17. Version 3.3.0 [13 Sep 2022] diff --git a/gen/template/utf16.h b/gen/template/utf16.h index 2ab03e8..6498a5e 100644 --- a/gen/template/utf16.h +++ b/gen/template/utf16.h @@ -112,8 +112,13 @@ void utf16::decode(const std::u16string& str, std::u32string& decoded) { decode(str.c_str(), decoded); } -class utf16::string_decoder::iterator : public std::iterator { +class utf16::string_decoder::iterator { public: + using iterator_category = std::input_iterator_tag; + using value_type = char32_t; + using difference_type = ptrdiff_t; + using pointer = char32_t*; + using reference = char32_t&; iterator(const char16_t* str) : codepoint(0), next(str) { operator++(); } iterator(const iterator& it) : codepoint(it.codepoint), next(it.next) {} iterator& operator++() { if (next) { codepoint = decode(next); if (!codepoint) next = nullptr; } return *this; } @@ -144,8 +149,13 @@ utf16::string_decoder utf16::decoder(const std::u16string& str) { return string_decoder(str.c_str()); } -class utf16::buffer_decoder::iterator : public std::iterator { +class utf16::buffer_decoder::iterator { public: + using iterator_category = std::input_iterator_tag; + using value_type = char32_t; + using difference_type = ptrdiff_t; + using pointer = char32_t*; + using reference = char32_t&; iterator(const char16_t* str, size_t len) : codepoint(0), next(str), len(len) { operator++(); } iterator(const iterator& it) : codepoint(it.codepoint), next(it.next), len(it.len) {} iterator& operator++() { if (!len) next = nullptr; if (next) codepoint = decode(next, len); return *this; } diff --git a/gen/template/utf8.h b/gen/template/utf8.h index 2dbdead..924c358 100644 --- a/gen/template/utf8.h +++ b/gen/template/utf8.h @@ -144,8 +144,13 @@ void utf8::decode(const std::string& str, std::u32string& decoded) { decode(str.c_str(), decoded); } -class utf8::string_decoder::iterator : public std::iterator { +class utf8::string_decoder::iterator { public: + using iterator_category = std::input_iterator_tag; + using value_type = char32_t; + using difference_type = ptrdiff_t; + using pointer = char32_t*; + using reference = char32_t&; iterator(const char* str) : codepoint(0), next(str) { operator++(); } iterator(const iterator& it) : codepoint(it.codepoint), next(it.next) {} iterator& operator++() { if (next) { codepoint = decode(next); if (!codepoint) next = nullptr; } return *this; } @@ -176,8 +181,13 @@ utf8::string_decoder utf8::decoder(const std::string& str) { return string_decoder(str.c_str()); } -class utf8::buffer_decoder::iterator : public std::iterator { +class utf8::buffer_decoder::iterator { public: + using iterator_category = std::input_iterator_tag; + using value_type = char32_t; + using difference_type = ptrdiff_t; + using pointer = char32_t*; + using reference = char32_t&; iterator(const char* str, size_t len) : codepoint(0), next(str), len(len) { operator++(); } iterator(const iterator& it) : codepoint(it.codepoint), next(it.next), len(it.len) {} iterator& operator++() { if (!len) next = nullptr; if (next) codepoint = decode(next, len); return *this; } diff --git a/unilib/utf16.h b/unilib/utf16.h index e54221e..cd80a3f 100644 --- a/unilib/utf16.h +++ b/unilib/utf16.h @@ -112,8 +112,13 @@ void utf16::decode(const std::u16string& str, std::u32string& decoded) { decode(str.c_str(), decoded); } -class utf16::string_decoder::iterator : public std::iterator { +class utf16::string_decoder::iterator { public: + using iterator_category = std::input_iterator_tag; + using value_type = char32_t; + using difference_type = ptrdiff_t; + using pointer = char32_t*; + using reference = char32_t&; iterator(const char16_t* str) : codepoint(0), next(str) { operator++(); } iterator(const iterator& it) : codepoint(it.codepoint), next(it.next) {} iterator& operator++() { if (next) { codepoint = decode(next); if (!codepoint) next = nullptr; } return *this; } @@ -144,8 +149,13 @@ utf16::string_decoder utf16::decoder(const std::u16string& str) { return string_decoder(str.c_str()); } -class utf16::buffer_decoder::iterator : public std::iterator { +class utf16::buffer_decoder::iterator { public: + using iterator_category = std::input_iterator_tag; + using value_type = char32_t; + using difference_type = ptrdiff_t; + using pointer = char32_t*; + using reference = char32_t&; iterator(const char16_t* str, size_t len) : codepoint(0), next(str), len(len) { operator++(); } iterator(const iterator& it) : codepoint(it.codepoint), next(it.next), len(it.len) {} iterator& operator++() { if (!len) next = nullptr; if (next) codepoint = decode(next, len); return *this; } diff --git a/unilib/utf8.h b/unilib/utf8.h index fe23e5a..46062cf 100644 --- a/unilib/utf8.h +++ b/unilib/utf8.h @@ -144,8 +144,13 @@ void utf8::decode(const std::string& str, std::u32string& decoded) { decode(str.c_str(), decoded); } -class utf8::string_decoder::iterator : public std::iterator { +class utf8::string_decoder::iterator { public: + using iterator_category = std::input_iterator_tag; + using value_type = char32_t; + using difference_type = ptrdiff_t; + using pointer = char32_t*; + using reference = char32_t&; iterator(const char* str) : codepoint(0), next(str) { operator++(); } iterator(const iterator& it) : codepoint(it.codepoint), next(it.next) {} iterator& operator++() { if (next) { codepoint = decode(next); if (!codepoint) next = nullptr; } return *this; } @@ -176,8 +181,13 @@ utf8::string_decoder utf8::decoder(const std::string& str) { return string_decoder(str.c_str()); } -class utf8::buffer_decoder::iterator : public std::iterator { +class utf8::buffer_decoder::iterator { public: + using iterator_category = std::input_iterator_tag; + using value_type = char32_t; + using difference_type = ptrdiff_t; + using pointer = char32_t*; + using reference = char32_t&; iterator(const char* str, size_t len) : codepoint(0), next(str), len(len) { operator++(); } iterator(const iterator& it) : codepoint(it.codepoint), next(it.next), len(it.len) {} iterator& operator++() { if (!len) next = nullptr; if (next) codepoint = decode(next, len); return *this; }