Any chance to call Tango as Extended Standard Library
BLS
nanali at nospam.wanadoo.fr
Sun Jan 18 11:49:56 PST 2009
Andrei Alexandrescu schrieb:
> Jarrett Billingsley wrote:
>> 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.)
>
> Returning a std.typecons.Tuple is entirely possible.
>
> Andrei
tuple(K,V) foo(K,V)(K k, V v)
{
...
}
????, I have no idea, pls help Bjoern
More information about the Digitalmars-d
mailing list