util/IntrusiveList: do not use the deprecated class std::iterator
Deprecated in C++17. Since C++17, one is supposed to declare those 5 types manually.
This commit is contained in:
parent
4dae8b41da
commit
1c97793b49
@ -235,9 +235,7 @@ public:
|
|||||||
|
|
||||||
class const_iterator;
|
class const_iterator;
|
||||||
|
|
||||||
class iterator final
|
class iterator final {
|
||||||
: public std::iterator<std::forward_iterator_tag, T> {
|
|
||||||
|
|
||||||
friend IntrusiveList;
|
friend IntrusiveList;
|
||||||
friend const_iterator;
|
friend const_iterator;
|
||||||
|
|
||||||
@ -247,6 +245,12 @@ public:
|
|||||||
:cursor(_cursor) {}
|
:cursor(_cursor) {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
using iterator_category = std::forward_iterator_tag;
|
||||||
|
using value_type = T;
|
||||||
|
using difference_type = std::ptrdiff_t;
|
||||||
|
using pointer = value_type *;
|
||||||
|
using reference = value_type &;
|
||||||
|
|
||||||
iterator() noexcept = default;
|
iterator() noexcept = default;
|
||||||
|
|
||||||
constexpr bool operator==(const iterator &other) const noexcept {
|
constexpr bool operator==(const iterator &other) const noexcept {
|
||||||
@ -283,9 +287,7 @@ public:
|
|||||||
return {&ToNode(t)};
|
return {&ToNode(t)};
|
||||||
}
|
}
|
||||||
|
|
||||||
class const_iterator final
|
class const_iterator final {
|
||||||
: public std::iterator<std::forward_iterator_tag, const T> {
|
|
||||||
|
|
||||||
friend IntrusiveList;
|
friend IntrusiveList;
|
||||||
|
|
||||||
const IntrusiveListNode *cursor;
|
const IntrusiveListNode *cursor;
|
||||||
@ -294,6 +296,12 @@ public:
|
|||||||
:cursor(_cursor) {}
|
:cursor(_cursor) {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
using iterator_category = std::forward_iterator_tag;
|
||||||
|
using value_type = const T;
|
||||||
|
using difference_type = std::ptrdiff_t;
|
||||||
|
using pointer = value_type *;
|
||||||
|
using reference = value_type &;
|
||||||
|
|
||||||
const_iterator() noexcept = default;
|
const_iterator() noexcept = default;
|
||||||
|
|
||||||
const_iterator(iterator src) noexcept
|
const_iterator(iterator src) noexcept
|
||||||
|
Loading…
Reference in New Issue
Block a user