Boost logo

Boost :

Subject: Re: [boost] [iterator] std::sort on zip_iterator (repost)
From: Steven Ross (spreadsort_at_[hidden])
Date: 2009-05-08 16:25:21


> If not, is there an alternative way to sort one sequence while swapping
>> elements in another in a corresponding way? I am not able to join the two
>> input sequences into a single sequence of pairs because of other factors in
>> the use case for this code. Thank you for your help.
>>
>
> std::sort requires a Random Access Iterator. zip_iterator is not a Random
> Access Iterator.
>

I've proposed a sorting library here; it only works for Random Access
Iterators, but there were some requests in the past for a more general sort
implementation.
Theoretically, anything that can be iterated and swapped can be sorted. Do
you have a genuine usage case where a sort would be useful where an item can
be iterated and swapped, but does not have a Random Access Iterator? If so,
I could reconsider the request and see if I can find (or write) an effective
algorithm and template it.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk