Walter Bright <[email protected]> wrote:
Simen kjaeraas wrote:
Walter Bright <[email protected]> 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