From 42e873e10c8d80dc990f939b760a1a9f5d5366a4 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Mon, 14 Jul 2003 16:22:10 +0000 Subject: [PATCH] various bugfixes. filter_/transform_iterator were misusing enable_if in a non-template context , and iterator_facade needed a forward declaration for full conformance. [SVN r19112] --- include/boost/iterator/filter_iterator.hpp | 12 ++++------ include/boost/iterator/iterator_facade.hpp | 8 ++++++- include/boost/iterator/transform_iterator.hpp | 22 +++++-------------- 3 files changed, 17 insertions(+), 25 deletions(-) diff --git a/include/boost/iterator/filter_iterator.hpp b/include/boost/iterator/filter_iterator.hpp index 5b16bb1..059afc5 100644 --- a/include/boost/iterator/filter_iterator.hpp +++ b/include/boost/iterator/filter_iterator.hpp @@ -56,16 +56,12 @@ namespace boost satisfy_predicate(); } - // don't provide this constructor if UnaryFunction is a - // function pointer type. Too dangerous. - filter_iterator( - typename iterators::enable_if< - is_class - , Iterator - >::type x - , Iterator end = Iterator()) + filter_iterator(Iterator x, Iterator end = Iterator()) : super_t(x), m_predicate(), m_end(end) { + // Don't allow use of this constructor if Predicate is a + // function pointer type, since it will be 0. + BOOST_STATIC_ASSERT(is_class::value); satisfy_predicate(); } diff --git a/include/boost/iterator/iterator_facade.hpp b/include/boost/iterator/iterator_facade.hpp index 5683cca..774323e 100644 --- a/include/boost/iterator/iterator_facade.hpp +++ b/include/boost/iterator/iterator_facade.hpp @@ -28,7 +28,13 @@ namespace boost { + // This forward declaration is required for the friend declaration + // in iterator_core_access + template class iterator_facade; + // Used as a default template argument internally, merely to + // indicate "use the default", this can also be passed by users + // explicitly in order to specify that the default should be used. struct use_default; namespace detail @@ -362,7 +368,7 @@ namespace boost , class Value , class AccessCategory , class TraversalCategory - , class Reference = BOOST_ARG_DEPENDENT_TYPENAME detail::const_qualified_ref::type + , class Reference = BOOST_DEDUCED_TYPENAME detail::const_qualified_ref::type , class Difference = std::ptrdiff_t > class iterator_facade diff --git a/include/boost/iterator/transform_iterator.hpp b/include/boost/iterator/transform_iterator.hpp index e0ab3dd..47ea9ac 100644 --- a/include/boost/iterator/transform_iterator.hpp +++ b/include/boost/iterator/transform_iterator.hpp @@ -115,23 +115,13 @@ namespace boost transform_iterator(Iterator const& x, UnaryFunction f) : super_t(x), m_f(f) { } - // don't provide this constructor if UnaryFunction is a - // function pointer type. Too dangerous. - transform_iterator( - // Sadly, GCC 3.2 seems to choke on the enable_if when - // UnaryFunction is a plain function pointer -#if BOOST_WORKAROUND(__GNUC__, BOOST_TESTED_AT(3)) \ - && BOOST_WORKAROUND(__GNUC_MINOR__, BOOST_TESTED_AT(2)) - Iterator const& x -#else - typename iterators::enable_if< - is_class - , Iterator const& - >::type x -#endif - ) + transform_iterator(Iterator const& x) : super_t(x) - {} + { + // don't provide this constructor if UnaryFunction is a + // function pointer type, since it will be 0. Too dangerous. + BOOST_STATIC_ASSERT(is_class::value); + } template transform_iterator(