File tree 3 files changed +34
-12
lines changed
3 files changed +34
-12
lines changed Original file line number Diff line number Diff line change 3
3
// This file provides the inline proxy implemenation for t_rr_node.
4
4
// See the t_rr_node class comment for additional details.
5
5
6
- #include " rr_node_types.h"
6
+ #include < cstddef>
7
+ #include < iterator>
7
8
#include " rr_node.h"
8
9
#include " rr_graph_storage.h"
9
10
10
- class node_idx_iterator : public std ::iterator<std::bidirectional_iterator_tag, const t_rr_node> {
11
+ class node_idx_iterator {
11
12
public:
13
+ using iterator_category = std::bidirectional_iterator_tag;
14
+ using difference_type = std::ptrdiff_t ;
15
+ using value_type = const t_rr_node;
16
+ using pointer = value_type*;
17
+ using reference = value_type&;
18
+
12
19
node_idx_iterator (t_rr_node value)
13
20
: value_(value) {}
14
21
15
- iterator operator ++() {
22
+ node_idx_iterator& operator ++() {
16
23
value_.next_node ();
17
24
return *this ;
18
25
}
19
- iterator operator --() {
26
+ node_idx_iterator& operator --() {
20
27
value_.prev_node ();
21
28
return *this ;
22
29
}
23
30
reference operator *() const { return value_; }
24
31
pointer operator ->() const { return &value_; }
25
32
26
- friend bool operator ==(const node_idx_iterator lhs, const node_idx_iterator rhs) { return lhs.value_ .id () == rhs.value_ .id (); }
27
- friend bool operator !=(const node_idx_iterator lhs, const node_idx_iterator rhs) { return !(lhs == rhs); }
33
+ friend bool operator ==(const node_idx_iterator& lhs, const node_idx_iterator& rhs) { return lhs.value_ .id () == rhs.value_ .id (); }
34
+ friend bool operator !=(const node_idx_iterator& lhs, const node_idx_iterator& rhs) { return !(lhs == rhs); }
28
35
29
36
private:
30
37
t_rr_node value_;
Original file line number Diff line number Diff line change 1
1
#ifndef RR_NODE_TYPES_H
2
2
#define RR_NODE_TYPES_H
3
3
4
+ #include < cstddef>
5
+ #include < iterator>
4
6
#include < string>
5
7
#include < vector>
6
8
#include < array>
@@ -64,23 +66,29 @@ typedef uint16_t t_edge_size;
64
66
*
65
67
* Used inconjunction with vtr::Range to return ranges of edge indices
66
68
*/
67
- class edge_idx_iterator : public std ::iterator<std::bidirectional_iterator_tag, t_edge_size> {
69
+ class edge_idx_iterator {
68
70
public:
71
+ using iterator_category = std::bidirectional_iterator_tag;
72
+ using difference_type = std::ptrdiff_t ;
73
+ using value_type = t_edge_size;
74
+ using pointer = t_edge_size*;
75
+ using reference = t_edge_size&;
76
+
69
77
edge_idx_iterator (value_type init)
70
78
: value_(init) {}
71
- iterator operator ++() {
79
+ edge_idx_iterator& operator ++() {
72
80
value_ += 1 ;
73
81
return *this ;
74
82
}
75
- iterator operator --() {
83
+ edge_idx_iterator& operator --() {
76
84
value_ -= 1 ;
77
85
return *this ;
78
86
}
79
87
reference operator *() { return value_; }
80
88
pointer operator ->() { return &value_; }
81
89
82
- friend bool operator ==(const edge_idx_iterator lhs, const edge_idx_iterator rhs) { return lhs.value_ == rhs.value_ ; }
83
- friend bool operator !=(const edge_idx_iterator lhs, const edge_idx_iterator rhs) { return !(lhs == rhs); }
90
+ friend bool operator ==(const edge_idx_iterator& lhs, const edge_idx_iterator& rhs) { return lhs.value_ == rhs.value_ ; }
91
+ friend bool operator !=(const edge_idx_iterator& lhs, const edge_idx_iterator& rhs) { return !(lhs == rhs); }
84
92
85
93
private:
86
94
value_type value_;
Original file line number Diff line number Diff line change 1
1
#ifndef VTR_RAGGED_MATRIX_H
2
2
#define VTR_RAGGED_MATRIX_H
3
+ #include < cstddef>
3
4
#include < vector>
4
5
#include < iterator>
5
6
@@ -212,8 +213,14 @@ class FlatRaggedMatrix {
212
213
* uses a callback to determine row lengths.
213
214
*/
214
215
template <class Callback >
215
- class RowLengthIterator : public std ::iterator<std::random_access_iterator_tag, size_t > {
216
+ class RowLengthIterator {
216
217
public:
218
+ using iterator_category = std::random_access_iterator_tag;
219
+ using difference_type = std::ptrdiff_t ;
220
+ using value_type = size_t ;
221
+ using pointer = size_t *;
222
+ using reference = size_t &;
223
+
217
224
RowLengthIterator (size_t irow, Callback& callback)
218
225
: irow_(irow)
219
226
, callback_(callback) {}
You can’t perform that action at this time.
0 commit comments