complement to $

Simen kjaeraas simen.kjaras at gmail.com
Sat May 15 10:44:47 PDT 2010


Walter Bright <newshound1 at digitalmars.com> wrote:

> Simen kjaeraas wrote:
>> Walter Bright <newshound1 at digitalmars.com> wrote:
>>
>>> KennyTM~ wrote:
>>>> Why a map type (sorted associative array)'s key must start at zero?
>>>
>>> You can special case the [0..$], or simply use [] to represent the  
>>> entire range.
>>  Of course, but assume you want the first 15 elements, what do you do?
>>
>
> For a map, does the first 15 elements even make any sense? There is no  
> order in a map.

std::map is ordered. Other data structures might make more sense.

A weird example would be a trie - slice all from the start
to ['f','o','o'], for instance.


-- 
Simen


More information about the Digitalmars-d mailing list