complement to $
Walter Bright
newshound1 at digitalmars.com
Sat May 15 11:01:32 PDT 2010
Simen kjaeraas wrote:
> 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.
If it's ordered, then why doesn't [0..15] make sense to get the first 15 elements?
More information about the Digitalmars-d
mailing list