Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::transform_iterator, boost::array::iterator and category
From: Hicham Mouline (hicham_at_[hidden])
Date: 2009-04-04 06:45:26


>Try returning a reference const double& instead of double.
>struct UnaryFunction {
> typedef const double& result_type;
> const double& operator()( const pair<double, double>& e ) const
> {
> return e.first;
> }
>};
>Random access iterators must return an lvalue.
>In Christ,
>Steven Watanabe

Thank you, the transformed iterator's category now matches
std::random_access_iterator_tag.

So in general, if I am passed a iterator (regardless whether it has been
transformed by transform_iterator<> or not), the most generic test for
random access category in C++03 __is__ against
std::random_access_iterator_tag, __not__ against
boost::random_access_traversal_tag.

The latter is some implementation detail for the Boost.Iterator library,
right?

Thanks again,


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