Boost logo

Boost Users :

Subject: Re: [Boost-users] [gil] Compilation errors with MSVC10
From: Christian Henning (chhenning_at_[hidden])
Date: 2010-05-29 19:02:11


Hi there again, a bit more information.

MSVC10 is complaining about that it cannot find the correct copy
algorithm implementation since for some reason the iterator categories
are messed up in its opinion. I doubt that. Here is why:

Copy takes an input and output interator type. My input type is:
bit_aligned_pixel_iterator< const pixel_t >.

The output is:
bit_aligned_pixel_iterator< pixel_t >.

Obviously the iterator category for both types is the same and when
asked for it results into:

boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::random_access_traversal_tag>.

Now when calling copy the compiler eventually has to decide what copy
implementation to use based on the iterator categories. For reasons I
don't understand right now it cannot choose between:

_OutIt std::_Copy_impl<_InIt,_OutIt>(_InIt,_InIt,_OutIt,std::input_iterator_tag,std::output_iterator_tag)

_OutIt std::_Copy_impl<_InIt,_OutIt>(_InIt,_InIt,_OutIt,std::random_access_iterator_tag,std::random_access_iterator_tag)

I would think the second one is the one to go with. I'm pretty sure
this behavior is new with MSVC10 and I cannot recall this problem with
older MSVCs. Unfortunately I don't have access to older versions right
now.

Anyone can help me out here?

Here some simple test code:

#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::reference pixel_t;

    typedef vector< unsigned char > buffer_t;
    typedef bit_aligned_pixel_iterator< pixel_t > it_t;

    image_t img( 10, 10 );
    image_t::view_t v = view( img );

    vector< unsigned char > buf( 100 );

    it_t begin = it_t( &buf.front(), 0 );
    it_t end = it_t( &buf.front(), 0 );

    typedef view_t::x_iterator x_it_t;

    x_it_t it = v.row_begin( 0 );

    std::copy( begin, end, it );

    return 0;
}

Thanks,
Christian


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