From 93cfa18f3d8d4ec2979f4e5565315b35ac678caf Mon Sep 17 00:00:00 2001 From: Daniela Engert Date: Tue, 2 Jan 2018 14:34:14 +0100 Subject: [PATCH] Inheriting std::iterator is deprecated in C++17 Boost's iterator.hpp is deprecated, too. Therefore get rid of all of that and replace inheritance by lifting std::iterator's members into the derived class. Signed-off-by: Daniela Engert --- include/boost/graph/adjacency_matrix.hpp | 2 +- include/boost/graph/detail/array_binary_tree.hpp | 8 +++++--- include/boost/graph/matrix_as_graph.hpp | 14 ++++++++++++-- include/boost/graph/stanford_graph.hpp | 1 - include/boost/graph/vector_as_graph.hpp | 9 ++++++--- 5 files changed, 24 insertions(+), 10 deletions(-) diff --git a/include/boost/graph/adjacency_matrix.hpp b/include/boost/graph/adjacency_matrix.hpp index ade7351fb..ab6ec2115 100644 --- a/include/boost/graph/adjacency_matrix.hpp +++ b/include/boost/graph/adjacency_matrix.hpp @@ -14,9 +14,9 @@ #include #include #include +#include #include #include -#include #include #include #include diff --git a/include/boost/graph/detail/array_binary_tree.hpp b/include/boost/graph/detail/array_binary_tree.hpp index fd403d1f3..a594ba6bf 100644 --- a/include/boost/graph/detail/array_binary_tree.hpp +++ b/include/boost/graph/detail/array_binary_tree.hpp @@ -14,7 +14,6 @@ #include #include #include -#include namespace boost { @@ -43,9 +42,12 @@ class array_binary_tree_node { struct children_type { struct iterator - : boost::iterator { // replace with iterator_adaptor implementation -JGS + typedef std::bidirectional_iterator_tag iterator_category; + typedef ArrayBinaryTreeNode value_type; + typedef size_type difference_type; + typedef array_binary_tree_node* pointer; + typedef ArrayBinaryTreeNode& reference; inline iterator() : i(0), n(0) { } inline iterator(const iterator& x) : r(x.r), i(x.i), n(x.n), id(x.id) { } diff --git a/include/boost/graph/matrix_as_graph.hpp b/include/boost/graph/matrix_as_graph.hpp index fb727940d..4e8d56b92 100644 --- a/include/boost/graph/matrix_as_graph.hpp +++ b/include/boost/graph/matrix_as_graph.hpp @@ -12,6 +12,8 @@ #define BOOST_GRAPH_MATRIX2GRAPH_HPP #include +#include +#include #include #include #include @@ -86,10 +88,14 @@ namespace boost { template class matrix_adj_iterator - : public std::iterator { typedef matrix_adj_iterator self; public: + typedef std::input_iterator_tag iterator_category; + typedef Vertex value_type; + typedef std::ptrdiff_t difference_type; + typedef Vertex* pointer; + typedef Vertex& reference; matrix_adj_iterator() { } matrix_adj_iterator(Iter i) : _iter(i) { } matrix_adj_iterator(const self& x) : _iter(x._iter) { } @@ -105,10 +111,14 @@ namespace boost { template class matrix_incidence_iterator - : public std::iterator { typedef matrix_incidence_iterator self; public: + typedef std::input_iterator_tag iterator_category; + typedef Iter value_type; + typedef std::ptrdiff_t difference_type; + typedef Iter* pointer; + typedef Iter& reference; matrix_incidence_iterator() { } matrix_incidence_iterator(Iter i) : _iter(i) { } matrix_incidence_iterator(const self& x) : _iter(x._iter) { } diff --git a/include/boost/graph/stanford_graph.hpp b/include/boost/graph/stanford_graph.hpp index 01431737b..d9b451a8f 100644 --- a/include/boost/graph/stanford_graph.hpp +++ b/include/boost/graph/stanford_graph.hpp @@ -10,7 +10,6 @@ #define BOOST_GRAPH_SGB_GRAPH_HPP #include -#include #include #include #include diff --git a/include/boost/graph/vector_as_graph.hpp b/include/boost/graph/vector_as_graph.hpp index b771eaf7f..1c3890224 100644 --- a/include/boost/graph/vector_as_graph.hpp +++ b/include/boost/graph/vector_as_graph.hpp @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include #include @@ -110,12 +110,15 @@ namespace boost { // need rewrite this using boost::iterator_adaptor template class val_out_edge_iterator - : public boost::iterator, - std::ptrdiff_t, std::pair*, const std::pair > { typedef val_out_edge_iterator self; typedef std::pair Edge; public: + typedef std::input_iterator_tag iterator_category; + typedef std::pair value_type; + typedef std::ptrdiff_t difference_type; + typedef std::pair* pointer; + typedef const std::pair reference; val_out_edge_iterator() { } val_out_edge_iterator(V s, Iter i) : _source(s), _iter(i) { } Edge operator*() const { return Edge(_source, *_iter); }