|
Boost : |
From: Anthony Williams (anthony_w.geo_at_[hidden])
Date: 2004-07-22 04:01:43
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
>
> boost::detail::iterator_category_with_traversal<std::input_iterator_tag,
> boost::random_access_traversal_tag>
>
> to either
> std::bidirectional_iterator_tag
> or
> std::random_access_iterator_tag.
> 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.
Anthony
-- Anthony Williams Senior Software Engineer, Beran Instruments Ltd.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk