<div dir="ltr">You can try my GContnrs unit (<a href="http://yann.merignac.free.fr/unit-gcontnrs.html">http://yann.merignac.free.fr/unit-gcontnrs.html</a>). It has tree sets that, as i understand them, can fulfill your needs.<br></div><div class="gmail_extra"><br><div class="gmail_quote">2016-12-04 11:25 GMT+01:00 Graeme Geldenhuys <span dir="ltr"><<a href="mailto:mailinglists@geldenhuys.co.uk" target="_blank">mailinglists@geldenhuys.co.uk</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Florain,<br>
<br>
Thanks for the quick response.<br>
<span class=""><br>
On 2016-12-04 10:06, Florian Klämpfl wrote:<br>
> You mean you want allow duplicates?<br>
<br>
</span>I want the list to silently ignore duplicates.<br>
<br>
eg:<br>
numberList.Duplicates := dupIgnore;<br>
numberList.Sorted := true;<br>
numberList.add(1);<br>
numberList.add(2);<br>
numberList.add(3);<br>
numberList.add(1);<br>
<br>
The list will only contain 3 items in the end and the list is always sorted.<br>
<span class=""><br>
> Then you should have a look at TFPGList, even if you do not like<br>
> generics. TFPGList is our approach to extend FPC carefully with generics.<br>
<br>
</span>At the moment I'm using FPC 2.6.4 for the work I'm doing. I can't yet<br>
move to FPC 3.0.0.<br>
<br>
My worry about Generics is the following statement in the fgl.pp unit:<br>
<br>
"<br>
{ be aware, this unit is a prototype and subject to be changed heavily }<br>
"<br>
<br>
So that tells me this is not to be used in production software as it is<br>
more like an experiment than anything else.<br>
<span class=""><br>
<br>
> As it is written in objfpc<br>
> mode, you are forced not to clutter your code with specializations but you do once a TInt8List =<br>
> specialize TFPGList<Int8> etc. and continue to use TInt8List.<br>
<br>
</span>This is good news at least. I also only use objfpc mode in my code. I'm<br>
not totally discarding the use of Generics, I'm just worried about that<br>
prototype statement I mentioned. That made me thing that I might be<br>
better off implementing my own TList<T> because I don't know the future<br>
of the fgl.pp unit. But then if I go to all the trouble of implementing<br>
my own TList<T> then I can just as well use TIntegerList = class(TList)<br>
or something (but I do realise this last point will most likely be more<br>
coding).<br>
<br>
<br>
ps:<br>
Is it recommended to always define a specialised type? I guess it<br>
makes the code more clear when read by a human. Or is it perfectly<br>
acceptable doing:<br>
<br>
var<br>
lst: specialize TFPGList<Int8>;<br>
begin<br>
...<br>
end;<br>
<span class=""><br>
<br>
> Further, TFPGList is a<br>
> wrapper/anchestor around TFPSList, so each specialization does not explode into another full TList<br>
> like implementation: a lot of code is shared by all specializations of TFPGList.<br>
<br>
</span>I was just looking over the fgl.pp unit and noticed that exact point. So<br>
that is at least another good design.<br>
<span class="im HOEnZb"><br>
<br>
Regards,<br>
Graeme<br>
<br>
--<br>
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal<br>
<a href="http://fpgui.sourceforge.net/" rel="noreferrer" target="_blank">http://fpgui.sourceforge.net/</a><br>
<br>
My public PGP key: <a href="http://tinyurl.com/graeme-pgp" rel="noreferrer" target="_blank">http://tinyurl.com/graeme-pgp</a><br>
</span><div class="HOEnZb"><div class="h5">______________________________<wbr>_________________<br>
fpc-pascal maillist - <a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.<wbr>org</a><br>
<a href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal" rel="noreferrer" target="_blank">http://lists.freepascal.org/<wbr>cgi-bin/mailman/listinfo/fpc-<wbr>pascal</a></div></div></blockquote></div><br></div>