diff --git a/libs/librrgraph/src/base/rr_node_impl.h b/libs/librrgraph/src/base/rr_node_impl.h index 4a76d0851bf..83b93e43b46 100644 --- a/libs/librrgraph/src/base/rr_node_impl.h +++ b/libs/librrgraph/src/base/rr_node_impl.h @@ -3,28 +3,35 @@ // This file provides the inline proxy implemenation for t_rr_node. // See the t_rr_node class comment for additional details. -#include "rr_node_types.h" +#include +#include #include "rr_node.h" #include "rr_graph_storage.h" -class node_idx_iterator : public std::iterator { +class node_idx_iterator { public: + using iterator_category = std::bidirectional_iterator_tag; + using difference_type = std::ptrdiff_t; + using value_type = const t_rr_node; + using pointer = value_type*; + using reference = value_type&; + node_idx_iterator(t_rr_node value) : value_(value) {} - iterator operator++() { + node_idx_iterator& operator++() { value_.next_node(); return *this; } - iterator operator--() { + node_idx_iterator& operator--() { value_.prev_node(); return *this; } reference operator*() const { return value_; } pointer operator->() const { return &value_; } - friend bool operator==(const node_idx_iterator lhs, const node_idx_iterator rhs) { return lhs.value_.id() == rhs.value_.id(); } - friend bool operator!=(const node_idx_iterator lhs, const node_idx_iterator rhs) { return !(lhs == rhs); } + friend bool operator==(const node_idx_iterator& lhs, const node_idx_iterator& rhs) { return lhs.value_.id() == rhs.value_.id(); } + friend bool operator!=(const node_idx_iterator& lhs, const node_idx_iterator& rhs) { return !(lhs == rhs); } private: t_rr_node value_; diff --git a/libs/librrgraph/src/base/rr_node_types.h b/libs/librrgraph/src/base/rr_node_types.h index 56c2b97c3e6..1b38848f21b 100644 --- a/libs/librrgraph/src/base/rr_node_types.h +++ b/libs/librrgraph/src/base/rr_node_types.h @@ -1,6 +1,8 @@ #ifndef RR_NODE_TYPES_H #define RR_NODE_TYPES_H +#include +#include #include #include #include @@ -64,23 +66,29 @@ typedef uint16_t t_edge_size; * * Used inconjunction with vtr::Range to return ranges of edge indices */ -class edge_idx_iterator : public std::iterator { +class edge_idx_iterator { public: + using iterator_category = std::bidirectional_iterator_tag; + using difference_type = std::ptrdiff_t; + using value_type = t_edge_size; + using pointer = t_edge_size*; + using reference = t_edge_size&; + edge_idx_iterator(value_type init) : value_(init) {} - iterator operator++() { + edge_idx_iterator& operator++() { value_ += 1; return *this; } - iterator operator--() { + edge_idx_iterator& operator--() { value_ -= 1; return *this; } reference operator*() { return value_; } pointer operator->() { return &value_; } - friend bool operator==(const edge_idx_iterator lhs, const edge_idx_iterator rhs) { return lhs.value_ == rhs.value_; } - friend bool operator!=(const edge_idx_iterator lhs, const edge_idx_iterator rhs) { return !(lhs == rhs); } + friend bool operator==(const edge_idx_iterator& lhs, const edge_idx_iterator& rhs) { return lhs.value_ == rhs.value_; } + friend bool operator!=(const edge_idx_iterator& lhs, const edge_idx_iterator& rhs) { return !(lhs == rhs); } private: value_type value_; diff --git a/libs/libvtrutil/src/vtr_ragged_matrix.h b/libs/libvtrutil/src/vtr_ragged_matrix.h index bbe7fea78fc..18ba18f9b58 100644 --- a/libs/libvtrutil/src/vtr_ragged_matrix.h +++ b/libs/libvtrutil/src/vtr_ragged_matrix.h @@ -1,5 +1,6 @@ #ifndef VTR_RAGGED_MATRIX_H #define VTR_RAGGED_MATRIX_H +#include #include #include @@ -212,8 +213,14 @@ class FlatRaggedMatrix { * uses a callback to determine row lengths. */ template - class RowLengthIterator : public std::iterator { + class RowLengthIterator { public: + using iterator_category = std::random_access_iterator_tag; + using difference_type = std::ptrdiff_t; + using value_type = size_t; + using pointer = size_t*; + using reference = size_t&; + RowLengthIterator(size_t irow, Callback& callback) : irow_(irow) , callback_(callback) {}