Skip to content

Conversation

@bjude
Copy link

@bjude bjude commented Nov 7, 2022

The main iterators for the halfedge meshes were almost forward iterators, this PR gets them to a usable state. They dont quite meet the LegacyForwardIterator requirements (https://en.cppreference.com/w/cpp/named_req/ForwardIterator) as they generate their elements on dereference, but they do meet the C++20 std::forward_iterator requirements so there shouldnt be any issue using them with STL algorithms (including C++20 ranges)

Closes #76

bjude added 2 commits November 7, 2022 22:50
…requirements

This allows the various set ranges to be used with std algorithms.

These iterators differ from the LegacyForwardIterator requirements (https://en.cppreference.com/w/cpp/named_req/ForwardIterator) in a couple of ways
- No operator->: Since these iterators construct their elements on dereference, theres not safe way to return pointer to one outside of using a proxy object. Operator-> isnt required for c++20's std::input_iterator concept so shouldnt be an issue for std algorithms
- std::iterator_traits<RangeIteratorBase<T>>::reference is not a reference: Similar reasoning to above, it could be defined as `const value_type&` but that could be asking for a dangling reference. This is also not a requirement for c++20's std::forward_iterator
…ator requirements

The `const bool` in `VertexNeighborIteratorState` was causing the default constructor for `NavigationIteratorBase<VertexAdjacentVertexNavigator>` and friends by implicitly deleting default constructors up the chain. This was solved by making the member variables private and adding `const` accessors. The functionality of the class should be the same, just a few renamings to avoid clashes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Standard Iterator Categories for RangeSetBase

1 participant