foreach, an analogy

Sean Kelly sean at f4.ca
Thu Oct 19 19:11:48 PDT 2006


Walter Bright wrote:
> Sean Kelly wrote:
> 
>> C++ tree containers don't have this problem because the performance 
>> requirements require a balanced tree,
> 
> The iterator requirement is what's really driving the design of C++ 
> containers. D's AAs deliver better performance than STL's trees.

Agreed.  Thankfully, C++ 0x will add unordered_map, etc, which are hash 
containers.

>> and nodes for such a structure contain a pointer to the parent node as 
>> well.
> 
> I know. They're also *far* more complex. Take a look at the STL source 
> for them. I wanted containers for D to be much easier to program.

foreach definately makes iteration through complex containers simpler, 
and offers more flexibility in container implementation without the need 
for messy tradeoffs.


Sean



More information about the Digitalmars-d-announce mailing list