mirror of
https://github.com/nemtrif/utfcpp.git
synced 2025-04-06 05:55:08 +00:00
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))
This commit is contained in:
parent
1537543999
commit
2130a02f56
2 changed files with 16 additions and 2 deletions
|
@ -265,11 +265,18 @@ namespace utf8
|
|||
|
||||
// The iterator class
|
||||
template <typename octet_iterator>
|
||||
class iterator : public std::iterator <std::bidirectional_iterator_tag, uint32_t> {
|
||||
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,
|
||||
|
|
|
@ -176,9 +176,16 @@ namespace utf8
|
|||
|
||||
// The iterator class
|
||||
template <typename octet_iterator>
|
||||
class iterator : public std::iterator <std::bidirectional_iterator_tag, uint32_t> {
|
||||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue