Skip to content

Commit

Permalink
Avoid deprecated std::iterator (#353)
Browse files Browse the repository at this point in the history
  • Loading branch information
Deev Patel authored Feb 21, 2024
1 parent 5b5eccd commit db21ca6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 7 additions & 2 deletions src/s2/s2builder_graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,14 @@ class S2Builder::Graph {

// A helper class for VertexOutMap that represents the outgoing edge *ids*
// from a given vertex.
class VertexOutEdgeIds
: public std::iterator<std::forward_iterator_tag, EdgeId> {
class VertexOutEdgeIds {
public:
using iterator_category = std::forward_iterator_tag;
using value_type = EdgeId;
using difference_type = std::ptrdiff_t;
using pointer = EdgeId*;
using reference = EdgeId&;

// An iterator over a range of edge ids (like boost::counting_iterator).
class Iterator {
public:
Expand Down
9 changes: 7 additions & 2 deletions src/s2/s2shape_index.h
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,14 @@ class S2ShapeIndex {
// for (S2Shape* shape : index) { ... }
//
// CAVEAT: Returns nullptr for shapes that have been removed from the index.
class ShapeIterator
: public std::iterator<std::forward_iterator_tag, S2Shape*> {
class ShapeIterator {
public:
using iterator_category = std::forward_iterator_tag;
using value_type = S2Shape*;
using difference_type = std::ptrdiff_t;
using pointer = S2Shape**;
using reference = S2Shape*&;

ShapeIterator() = default;
S2Shape* operator*() const;
ShapeIterator& operator++();
Expand Down

0 comments on commit db21ca6

Please sign in to comment.