From 2130a02f5667c0253d2d1424f7e6ff488b241d4a Mon Sep 17 00:00:00 2001 From: GhassanPL Date: Wed, 28 Mar 2018 16:04:07 +0200 Subject: [PATCH] Iterators now respect std::iterator deprecation and are now correct in terms of iterator_traits (pointer and reference are not actually uint32_t* and uint32_t& but regular uint32_t (this enables reversed_iterator amongst other things)) --- source/utf8/checked.h | 9 ++++++++- source/utf8/unchecked.h | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/source/utf8/checked.h b/source/utf8/checked.h index 2aef583..53206e0 100644 --- a/source/utf8/checked.h +++ b/source/utf8/checked.h @@ -265,11 +265,18 @@ namespace utf8 // The iterator class template - class iterator : public std::iterator { + class iterator { octet_iterator it; octet_iterator range_start; octet_iterator range_end; public: + + using iterator_category = std::bidirectional_iterator_tag; + using value_type = uint32_t; + using difference_type = ptrdiff_t; + using pointer = uint32_t; + using reference = uint32_t; + iterator () {} explicit iterator (const octet_iterator& octet_it, const octet_iterator& rangestart, diff --git a/source/utf8/unchecked.h b/source/utf8/unchecked.h index cb24271..124c842 100644 --- a/source/utf8/unchecked.h +++ b/source/utf8/unchecked.h @@ -176,9 +176,16 @@ namespace utf8 // The iterator class template - class iterator : public std::iterator { + class iterator { octet_iterator it; public: + + using iterator_category = std::bidirectional_iterator_tag; + using value_type = uint32_t; + using difference_type = ptrdiff_t; + using pointer = uint32_t; + using reference = uint32_t; + iterator () {} explicit iterator (const octet_iterator& octet_it): it(octet_it) {} // the default "big three" are OK