== Quote from Andrei Alexandrescu ([email protected])'s article > Lars Ivar Igesund wrote: > > Andrei Alexandrescu wrote: > > > >> For example, I'm not sure how code in std.algorithm could help > >> containers or streams in Tango (as it should), or how to reconcile > >> std.algorithm with std.core.array. > > > > If the language (D2++) will have a new way of iteration and ranges > > known and enforced by the compiler, then I expect Tango to support > > those at some point, and std.algorithm would presumably just work. > > However, if it is based on some interface, ad hoc (these methods must > > be present) or properly via an interface Range { }, I would expect > > Tango developers to be involved in the process of defining those > > interfaces (if Tango is meant to use/know about them). Since I have > > seen neither, it is somewhat difficult to make a well informed > > comment on the subject. > It's been there for a while now (since 25 Nov 2008). > http://www.digitalmars.com/d/2.0/statement.html#ForeachStatement > Scroll down to "Foreach over Structs and Classes with Ranges". The > changelog reflects that too: > http://www.digitalmars.com/d/2.0/changelog.html > Version 2.021 mentions "Added range support to foreach statement." > Andrei
Nice. Glad to see that this is documented somewhere so I can start playing with it. One thing, though: In my dstats library, I have a custom hash table implementation that's used very heavily in my information theory module. (I have my reasons for using a custom hash table instead of the builtin, but they're beyond the scope of this post.) Right now, the hash table uses opApply. Now that I realize how horribly slow opApply is, I'd like to port this to ranges. However, I need to be able to iterate over either key, value pairs or just values. Is there any way to make this work with ranges?
