[fpc-pascal] Elegant way to switch sort mechanism in TSortedCollection?

Frederic Da Vitoria davitofrg at gmail.com
Wed Mar 12 23:06:01 CET 2014


2014-03-12 21:56 GMT+01:00 Jim Leonard <trixter at oldskool.org>:

> On 3/12/2014 2:30 PM, Philippe wrote:
>
>> Type
>> TMethod = ( method_type_1, method_type_2, method_type_3);
>>
>
> Ah, clever -- create a Compare that switches based on what I tell it to
> do.  I like that, but as far as I can tell there's no way to tell a
> TSortedCollection to "resort" -- it's kept sorted only through inserts and
> deletes.
>

You (or the user) will never need to resotre the first order? I am asking
because you could as well simply create one SortedCollection for each sort
order and systematically insert each item in all those collections. The
overhead would be in the initial loading, but then switching would be
instantaneous.

-- 
Frederic Da Vitoria
(davitof)

Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20140312/9766c68a/attachment.html>


More information about the fpc-pascal mailing list