|
Boost : |
From: François Duranleau (duranlef_at_[hidden])
Date: 2006-11-06 10:22:26
On Mon, 6 Nov 2006, Neal Becker wrote:
> This simple test illustrates the problem:
>
> #include <boost/iterator/permutation_iterator.hpp>
> #include <vector>
> #include <boost/range.hpp>
>
> template<typename in_t>
> void F (in_t const& in) {
> typename boost::range_const_iterator<in_t>::type inp = boost::begin (in);
> }
>
> int main () {
> std::vector<int> x, y;
> F (boost::make_permutation_iterator (boost::begin (x), boost::begin (y)));
> }
>
> /usr/local/src/boost.hg/boost/range/const_iterator.hpp:37: error: no type
> named
> const_iterator in class
> boost::permutation_iterator<__gnu_cxx::__normal_iterator<int*,
> std::vector<int, std::allocator<int> > >,
> __gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int> > >
The problem has nothing to do with constness. make_permutation_iterator
return's an iterator (a permutation_iterator), not a range. But you try to
use it as a range. To get the range, to need to call
make_permutation_iterator twice: once as you did, and another time with
'end'.
-- François Duranleau LIGUM, Université de Montréal "The real source of wealth is correct ideas: workable ideas: that is, negative entropy -- Information." - Robert Anton Wilson, _Prometheus Rising_, 1983
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk