container stuff
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Wed May 26 21:23:05 PDT 2010
On 05/26/2010 04:47 PM, Steven Schveighoffer wrote:
>> b) associative arrays can define c[a .. b] for a, b key types.
>> It's nontrivial but it can be done.
>
> I decided for dcollections that this only makes sense on sorted maps.
Yah, I meant sorted collections as well.
>> c) sentinel-terminated arrays (e.g. C stringz) can only define c[a
>> .. $] for an integral a.
>
> I really hope we are not considering null-terminated strings when
> deciding container functions...
I don't know. When working on an abstraction I find it very, very useful
to anchor it in concrete incarnations that I know of. (Such an approach
has led to taming the gnarly UTF-8 strings into nice bidirectional
ranges.) I'm not crazy about null-terminated strings, but slists are
also sentinel terminated, they just aren't contiguous. Comparing and
contrasting these and other concrete instantiations is great exercise
that only makes the abstraction better.
>> e) Any other cases?
>
> On a sorted AA, slicing using any two keys are possible (as long as
> the keys exist in the AA).
Great.
Andrei
More information about the Digitalmars-d
mailing list