TreeSet

Steven Schveighoffer schveiguy at yahoo.com
Mon Aug 4 04:42:47 PDT 2008


"toki" <thorstenkiefer at gmx.de> wrote in message 
news:g74egl$2f07$1 at digitalmars.com...
> Steven Schveighoffer Wrote:
>
>> "Toki" wrote
>> > Hi,
>> > I want to port my Java app to D.
>> > Is there sometinhg like a TreeSet in D?
>>
>> I highly recommend Tango's new containers, as they offer the best
>> performance.  But if you have to stick with the default D library 
>> (Phobos),
>> consider dcollections:  http://www.dsource.org/projects/dcollections
>>
>> -Steve
>>
>>
>
> Thank you, dcollections is much easier to install.
> But when i compile my program, I gat the following errors :
>
> main.o: In function 
> `_D12dcollections6RBTree13__T6RBTreeTiZ6RBTree6removeMFC12dcollections6RBTree13__T6RBNodeTiZ6RBNodeZC12dcollections6RBTree13__T6RBNodeTiZ6RBNode':
> satsolver.d:(.text._D12dcollections6RBTree13__T6RBTreeTiZ6RBTree6removeMFC12dcollections6RBTree13__T6RBNodeTiZ6RBNodeZC12dcollections6RBTree13__T6RBNodeTiZ6RBNode+0x1e): 
> undefined reference to `_D12dcollections6RBTree8__assertFiZv'
> main.o: In function 
> `_D12dcollections6RBTree13__T6RBNodeTiZ6RBNode7rotateRMFZC12dcollections6RBTree13__T6RBNodeTiZ6RBNode':
> satsolver.d:(.text._D12dcollections6RBTree13__T6RBNodeTiZ6RBNode7rotateRMFZC12dcollections6RBTree13__T6RBNodeTiZ6RBNode+0x17): 
> undefined reference to `_D12dcollections6RBTree8__assertFiZv'
> main.o: In function 
> `_D12dcollections6RBTree13__T6RBNodeTiZ6RBNode7rotateLMFZC12dcollections6RBTree13__T6RBNodeTiZ6RBNode':
> satsolver.d:(.text._D12dcollections6RBTree13__T6RBNodeTiZ6RBNode7rotateLMFZC12dcollections6RBTree13__T6RBNodeTiZ6RBNode+0x17): 
> undefined reference to `_D12dcollections6RBTree8__assertFiZv'
> main.o: In function 
> `_D12dcollections6RBTree13__T6RBNodeTiZ6RBNode10isLeftNodeMFZb':
> satsolver.d:(.text._D12dcollections6RBTree13__T6RBNodeTiZ6RBNode10isLeftNodeMFZb+0x1b): 
> undefined reference to `_D12dcollections6RBTree8__assertFiZv'
>
> -TK

Sorry about that.  The reason is because dcollections is not built as a 
library, so you must actually compile the dcollections modules in addition 
to your modules.  Or make it a library.  I probably should do this...

What I do when using dcollections is:

dmd mymodule1.d mymodule2.d path/to/dcollections/*.d

You don't have to build the model directory.  Note that the above might add 
more size to your executable than you need, but it's easy to type.  If you 
just want TreeSet, compile RBTree.d, TreeSet.d, (and if you used the svn 
trunk, DefaultAllocator.d).

-Steve 





More information about the Digitalmars-d mailing list