From: David Abrahams (dave_at_[hidden])
Date: 2004-07-22 12:03:25
Anthony Williams <anthony_w.geo_at_[hidden]> writes:
> David Abrahams <dave_at_[hidden]> writes:
>> Anthony Williams <anthony_w.geo_at_[hidden]> writes:
>>> Gunter Winkler <guwi17_at_[hidden]> writes:
>>>> I tried to use boost::zip_iterator to sort 2 parallel arrays. Unfortunatly
>>>> gcc does not compile the appended example because it can not convert
>>>> to either
>>>> Thus it cannot dispatch the correct stl::__copy_backward() procedure.
>>>> Is sort() not yet supported?
>>> As Dave already posted, zip_iterator doesn't support return forward or
>>> bidirectional iterators, so std::sort() cannot be used.
>>> What you need is something like my tuple iterator (tupleit.zip from the files
>>> area on the boost yahoo group), which *does* support use with std::sort ---
>>> the iterator category of the tuple iterator is the minimum category of the
>>> supplied iterators.
>> How can sorting work?
>> What type is returned from its operator* ?
> For Forward, Bidi and Random-access Iterators, it returns a reference to a
> value held in the iterator.
I'm afraid those aren't conforming forward iterators :(
"If a and b are both dereferenceable, then a == b if and only if
*a and *b are the same object. "
Which is why we have to change counting_iterator to not be a forward
-- Dave Abrahams Boost Consulting http://www.boost-consulting.com