Associative Ranges
Freddy via Digitalmars-d
digitalmars-d at puremagic.com
Sat Aug 2 11:39:03 PDT 2014
On Saturday, 2 August 2014 at 15:46:31 UTC, Xinok wrote:
> On Saturday, 2 August 2014 at 14:49:49 UTC, bearophile wrote:
>> Xinok:
>>
>>> I do wonder if we should generalize an interface for these
>>> types of ranges.
>>
>> First of all you need some use cases and usage examples.
>>
>> Bye,
>> bearophile
>
> The most obvious use case is generic functions that can operate
> on associative ranges of any type, regardless of
> implementation. There are various ways to implement and
> optimize hash tables for specific use cases, so it would be
> convenient not to be restricted to a single container.
>
> As for usage examples, I don't have any because I'm not sure
> what the primitives should be. I will emphasize that
> "associative ranges" should be distinguishable from
> random-access ranges. If they weren't, then we would have to
> comb through Phobos and add checks everywhere, e.g.
> (!isAssociativeRange!Range). I don't think forward ranges and
> bidirectional ranges would be an issue though.
It might be a ploblem if you have an Associative Range where the
key is size_t unless Associative ranges are not Input/Forward
Ranges
More information about the Digitalmars-d
mailing list