Boost logo

Boost Users :

From: Jeff Flinn - wwnet (jflinn_at_[hidden])
Date: 2002-02-19 07:57:40


I've discovered the difference between the
http://www.boost.org/libs/utility/permutation_iterator.htm example and the
http://www.boost.org/libs/utility/iterator_adaptor_test.cpp test code is
that the former (along with the example below) use vector<int> as the
element_range_type, while the latter uses deque<int>. In my environment,
permutation iterator works when used with deques but doesn't compile using
vector as exhibited below. I've copied the test case and replaced deque with
vector reproducing the problem.

Again the compiler complains about "struct
boost::detail::iterator_traits_::undefined<void>". Since Toon says that the
below code works with with gcc-2.95.3 as well as gcc-3.0.3, does any one
know of MSVC vector issues that could be the source of this problem? I will
try this using MSVC and STLPORT this evening on another machine to see if
the problem persists.

Thanks, Jeff

----- Original Message -----
From: "Toon Knapen" <toon.knapen_at_[hidden]>
To: <Boost-Users_at_[hidden]>
Sent: Tuesday, February 19, 2002 3:02 AM
Subject: Re: [Boost-Users] Permutation Iterator Adaptor Problem

> I just tried your code with gcc-2.95.3 as well as gcc-3.0.3 and no
> problems there.
> Looking at the status page, the iterator_adaptors test, which includes a
> test for the permutation_iterator, compiles fine with VC++ 6.0 SP5. I
> don't use windows though so that's all I can say at this point.
>
> I do want to add that, if your compilation succeeds, you will have a
> runtime error. The only index you have is '1' although the elements
> container is of size() 1 (and thus the only valid index is zero)
>
>
> Jeff Flinn - wwnet wrote:
>
> > I'm trying to use the Permutation Iterator adaptor on MSV++ w/SP5 with
> > boost_1_27_0. Below is a simplification of the example on the web site,
> > which results in the compiler error found below function main: Any
ideas?
> >
> > #include <list>
> > #include <vector>
> > #include <boost/permutation_iterator.hpp>
> >
> > int main(int argc, char* argv[])
> > {
> > typedef std::vector < int > tElements; typedef
> > tElements::iterator tEItr;
> > typedef std::list < int > tIdxs; typedef
> > tIdxs::iterator tIItr;
> > typedef std::ostream_iterator< int > tOItr;
> >
> > tElements elements( 1, 1 );
> > tIdxs indices ( 1, 1 );
> >
> > typedef boost::permutation_iterator_generator< tEItr, tIItr >::type
> > tPItr;
> >
> > tPItr begin = boost::make_permutation_iterator( elements.begin(),
> > indices.begin() );
> >
> > int val = *begin;
> >
> > return 0;
> > }
> >
> > error C2440: 'initializing' : cannot convert
> > from 'struct boost::detail::iterator_traits_::undefined<void>'
> > to 'int'
> > Source or target has incomplete type
> >
>
>
>
>
> Info: <http://www.boost.org>
> Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl>
> Unsubscribe: <mailto:boost-users-unsubscribe_at_[hidden]>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>


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