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]
This commit is contained in:
Dave Abrahams
2003-07-14 16:22:10 +00:00
parent 57a40c8cd2
commit 42e873e10c
3 changed files with 17 additions and 25 deletions

View File

@ -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<Predicate>
, 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<Predicate>::value);
satisfy_predicate();
}

View File

@ -28,7 +28,13 @@
namespace boost
{
// This forward declaration is required for the friend declaration
// in iterator_core_access
template <class I, class V, class AC, class TC, class R, class D> 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<Value, AccessCategory>::type
, class Reference = BOOST_DEDUCED_TYPENAME detail::const_qualified_ref<Value, AccessCategory>::type
, class Difference = std::ptrdiff_t
>
class iterator_facade

View File

@ -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<UnaryFunction>
, 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<UnaryFunction>::value);
}
template<class OtherIterator>
transform_iterator(