|
Boost Users : |
Subject: [Boost-users] boost::transform_iterator, boost::array::iterator and category
From: Hicham Mouline (hicham_at_[hidden])
Date: 2009-04-03 07:42:28
Hello,
I have boost::array< pair<double, double>, 16 >::iterator (it has
iterator_traits<>::iterator_category
random_access_iterator_tag)
which I have transformed with
typedef transform_iterator< UnaryFunction, ... > iteratorIntoFirst;
struct UnaryFunction: public std::unary_function< pair<double, double>,
double> {
double operator()( const pair<double, double>& e ) const
{
return e.first;
}
}
However on asserting the category is still random access, boost static
assert fails:
BOOST_STATIC_ASSERT((
boost::is_convertible<
iteratorIntoFirst,
std::random_access_iterator_tag
>::value
));
>From the docs
http://www.boost.org/doc/libs/1_38_0/libs/iterator/doc/transform_iterator.ht
ml
If Iterator models Readable Lvalue Iterator and if Iterator models "Random
Access Traversal Iterator", then iterator_category is convertible to
random_access_iterator_tag.
Any ideas,
Regards,
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net