From 1a7996ebd07aa15391d77cae6a787f917487d2ec Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Wed, 2 Apr 2025 00:09:36 +0300 Subject: [PATCH] Fixed compilation of filter_iterator conversion constructor. The constructor would attempt to access a private member of the source iterator, which could have a different type and therefore have that member inaccessible. Also, the storage forwarding constructor had incorrect types used in the forwarding expressions, which caused further compilation errors. Fixes https://github.com/boostorg/iterator/issues/90. --- include/boost/iterator/filter_iterator.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/boost/iterator/filter_iterator.hpp b/include/boost/iterator/filter_iterator.hpp index 29d8176..a91b7e9 100644 --- a/include/boost/iterator/filter_iterator.hpp +++ b/include/boost/iterator/filter_iterator.hpp @@ -46,6 +46,9 @@ class filter_iterator : { friend class iterator_core_access; + template< typename, typename > + friend class filter_iterator; + private: using super_t = detail::filter_iterator_base_t< Predicate, Iterator >; @@ -75,7 +78,7 @@ private: template< typename Pred, typename Iter > storage(Pred&& pred, Iter&& end) : - predicate_base(boost::empty_init_t{}, static_cast< Predicate&& >(pred)), m_end(static_cast< Iterator&& >(end)) + predicate_base(boost::empty_init_t{}, static_cast< Pred&& >(pred)), m_end(static_cast< Iter&& >(end)) { }