<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html><body>
<p>solution may depend on the way the collection is used. load once? many inserts and deletes? ... the time you have to switch from one sort to another ... and the size of the collection ...</p>
<p>you could</p>
<p>- store the actual collection to a TMemoryStream,</p>
<p>- destroy the collection,</p>
<p>- Load then a new collect to be sort with different method ...</p>
<p><br />2014-03-12 21:56 GMT+01:00 Jim Leonard <<a href="mailto:trixter@oldskool.org">trixter@oldskool.org</a>>:Em 12.03.2014 19:06, Frederic Da Vitoria escreveu:</p>
<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px; width:100%"><!-- html ignored --><!-- head ignored --><!-- meta ignored -->
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin: 0px  0px  0px  0.8ex; border-left: 1px  solid rgb; padding-left: 1ex;">On 3/12/2014 2:30 PM, Philippe wrote:<br />
<blockquote class="gmail_quote" style="margin: 0px  0px  0px  0.8ex; border-left: 1px  solid rgb; padding-left: 1ex;">Type<br /> TMethod = ( method_type_1, method_type_2, method_type_3);</blockquote>
<br /> 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.<span><span style="color: #888888;"><br /></span></span></blockquote>
</div>
</div>
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. <br />
<div class="gmail_extra"><br />-- <br />Frederic Da Vitoria<br />(davitof)<br /><br />Membre de l'April - « promouvoir et défendre le logiciel libre » - <a href="http://www.april.org">http://www.april.org</a></div>
</div>
<br />
<pre>_______________________________________________
fpc-pascal maillist  -  <a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>
<a href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal</a>
</pre>
</blockquote>
<p> </p>
</body></html>