Boost logo

Boost :

Subject: [boost] [gil] how does dereference_iterator_adaptor defines it's iterator category?
From: Christian Henning (chhenning_at_[hidden])
Date: 2010-06-01 04:01:46


Hi all,

I'm still investigating compilation errors with my gil extension while
compiling on MSVC10. I have exchanged
boost::random_access_traversal_tag with
std::random_access_iterator_tag with all gil iterator types. This
solved some of my problems. Some still remain. Here is what I have
discovered.

When using a boost::gil::kth_channel_view_type with bit_aligned image
types I'm running into the same problem I had with just using
bit_aligned image types. Now kth_channel_view_type uses a
boost::gil::dereference_iterator_adaptor for iteration purposes. This
adaptor defines it's iterator category as
boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::random_access_traversal_tag>
which is wrong. I have been trying to figure out where this definition
is coming from. But I'm not able to. All occurrences of
random_access_traversal_tag have been removed from gil code. Which
leads me to believe it's coming from boost itself somewhere.

Here is some code displaying the problem.

#include <vector>
#include <algorithm>

#include <boost/gil/gil_all.hpp>

using namespace std;
using namespace boost;
using namespace boost::gil;

int main(int argc, char* argv[])
{
    typedef bit_aligned_image1_type< 1, gray_layout_t >::type image_t;

    typedef image_t::view_t view_t;
    typedef view_t::x_iterator view_it_t;
    typedef view_it_t::iterator_category view_cat_t;

    // it's std::random_access_iterator_tag
    view_cat_t view_cat;

    typedef kth_channel_view_type< 0, view_t >::type plane_t;
    typedef plane_t::x_iterator plane_it_t;
    typedef plane_it_t::iterator_category plane_cat_t;

    // it's boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::random_access_traversal_tag>
    plane_cat_t plane_cat;

    return 0;
}

Regards,
Christian


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk