Boost logo

Boost Users :

From: Thomas Matelich (matelich_at_[hidden])
Date: 2005-03-07 17:11:00


On Tue, 01 Mar 2005 12:55:21 -0500, David Abrahams
<dave_at_[hidden]> wrote:
> Thomas Matelich <matelich_at_[hidden]> writes:
>
> > I'm a little behind the times and am trying to port my old
> > iterator_adapters code to use the new library (1.32). We have a class
> > which is little more than a wrapper around a vector<shared_ptr<T> >,
> > and I am having a heck of a time with setting its typedef for
> > reverse_iterator and const_reverse_iterator. I just can't get
> > const_reverse_iterator to do assignment and comparison with
> > reverse_iterator.
> >
> > I've tried to make indirect_iterators out of the native reverse
> > iterators,
>
> That almost certainly won't work, because the native reverse_iterator
> usually won't play nicely with the native const_reverse_iterator.
>
> > using boost::reverse_iterators of indirect_iterators
>
> What happens when you do that? (code, error messages)
> Have you verified that the const and mutable indirect_iterators
> interoperate the way you'd like?
>

So, of course, my sample application (attached) compiles just fine. I
went through and made sure I'm using the same compile options in my
sample project and real project (MSVC 7.1). In my failing version
assigning a rev_iterator to a const_rev_iterator fails with the
following error:

smartlisttest.cpp(352) : error C2440: 'initializing' : cannot convert
from 'ZUtil::SmartList<T>::rev_iterator' to
'boost::reverse_iterator<Iterator>'
        with
        [
            T=TestItem
        ]
        and
        [
            Iterator=ZUtil::SmartList<TestItem>::const_iterator
        ]
        No constructor could take the source type, or constructor
overload resolution was ambiguous

Does that error ring a bell? I'm about ready to drop the new
iterators or rewrite this class, neither of which I really want to do
at this point.

Thanks,
Tom




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