Any chance to call Tango as Extended Standard Library
Jarrett Billingsley
jarrett.billingsley at gmail.com
Sun Jan 18 10:09:41 PST 2009
On Sun, Jan 18, 2009 at 1:00 PM, dsimcha <dsimcha at yahoo.com> wrote:
>
> 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?
>
You could handle key or value iteration by using a proxy struct type
that follows the range protocol, and have your hash table return one
of those structs from methods such as "keysIter" or "valuesIter". But
unless I'm mistaken, D2 still doesn't support returning tuples, so you
still can't have keys _and_ values at the same time. (Unless you're
content with using a Pair or something.)
More information about the Digitalmars-d
mailing list