Skip to content

Commit

Permalink
fix: Fit iterator traits for ContainerIndexIterator (#3689)
Browse files Browse the repository at this point in the history
It looks like that `std:: iterator_traits< Acts::ContainerIndexIterator< whatever ...> >::iterator_category ` was evaluated to `std::output_iterator_tag` instead of `Iter::iterator_category` (i.e. `std::random_access_iterator_tag`). This made it impossible to use `std::distance` with this iterator class.

See https://en.cppreference.com/w/cpp/iterator/iterator_traits  to see why.

This PR fixes it.
  • Loading branch information
CarloVarni authored Oct 3, 2024
1 parent a42ce7c commit 532169b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Core/include/Acts/Utilities/Iterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class ContainerIndexIterator {
using container_type =
std::conditional_t<Const, const _Container, _Container>;
using difference_type = std::ptrdiff_t;
using pointer = void;
using reference = void;

ContainerIndexIterator() : m_container(nullptr), m_index(0) {}

Expand Down

0 comments on commit 532169b

Please sign in to comment.