diff --git a/src/util/DereferenceIterator.hxx b/src/util/DereferenceIterator.hxx index 1e68160e9..709df6ac4 100644 --- a/src/util/DereferenceIterator.hxx +++ b/src/util/DereferenceIterator.hxx @@ -13,6 +13,11 @@ template::value_type>())>> class DereferenceIterator { + /* this friend declaration allows the template operator==() to + compare arbitrary specializations */ + template + friend class DereferenceIterator; + using Traits = std::iterator_traits; IT original; @@ -77,7 +82,10 @@ public: return DereferenceIterator{original - n}; } - constexpr bool operator==(const DereferenceIterator &other) const noexcept { + /* this is a template to allow comparisons with sentinel end + iterators */ + template + constexpr bool operator==(const DereferenceIterator &other) const noexcept { return original == other.original; } };