Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Class concept in tango

Moderators: larsivi kris

Posted: 09/15/08 08:22:52

Hello, I am quite new in D or tango and would like to understand the "why"..... yesterday I was looking for a LinkedList? implementation in tango and found tango.util.container.LinkedList?.... This was the beginning of a longsearch to find a suitable iterator class for this. After a while I realised there is a struct called Iterator inside the LinkedList?.d and the whole class is not using the Iterator classes in tango. Is there a reason? I know Stack, Struct and Heap-activity but is there a design reason? A leading concept that has to be understood to use tango?

regards Marc

Author Message

Posted: 09/21/08 18:07:31

Hi Marc, and thanks for the ticket on that LinkedList issue.

D doesn't yet have a generic and lightweight iterator notion, per se, so you'll find a couple of varieties within Tango. There are iterators for data streams, and iterators for containers. Both have different needs, and thus do not share a common implementation. However, each exposes a way to support foreach() ... which is perhaps the closest that D gets to a generic iterator mechanism.