diff --git a/c++/itertools/itertools.hpp b/c++/itertools/itertools.hpp index 997764b..4786279 100644 --- a/c++/itertools/itertools.hpp +++ b/c++/itertools/itertools.hpp @@ -67,6 +67,7 @@ namespace itertools { template inline typename std::iterator_traits::difference_type distance(Iter first, EndIter last) { if constexpr (std::is_same_v::iterator_category, std::random_access_iterator_tag>) { + // Difference should be defined also for the the case that last is a sentinel return last - first; } else { typename std::iterator_traits::difference_type r(0);