Skip to content

Commit 922a659

Browse files
CLIF Teamrwgk
CLIF Team
authored andcommitted
Avoid std::iterator inheritance as it has been deprecated since C++17.
See: - https://en.cppreference.com/w/cpp/iterator/iterator - https://cplusplus.github.io/LWG/issue2438 PiperOrigin-RevId: 611347268
1 parent 1ce44c3 commit 922a659

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

clif/testing/iterator.h

+8-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
// It's using exceptions to demonstrate they are handled correctly by CLIF.
2323

2424
#include <array>
25+
#include <cstddef>
2526
#include <iterator>
2627

2728
namespace clif_iterator_test {
@@ -30,8 +31,14 @@ template<typename T, size_t N>
3031
class Ring {
3132
public:
3233
// Mimic std containers, so that Ring::const_iterator is a real thing.
33-
class const_iterator: public std::iterator<std::forward_iterator_tag, T> {
34+
class const_iterator {
3435
public:
36+
using value_type = T;
37+
using difference_type = ptrdiff_t;
38+
using pointer = T*;
39+
using reference = T&;
40+
using iterator_category = std::forward_iterator_tag;
41+
3542
// CLIF requires both or neither of copy/move constructors and copy/move
3643
// copy assignment operators.
3744
const_iterator(const const_iterator&) = default;

0 commit comments

Comments
 (0)