Talk:Associative array/Iteration

From Rosetta Code
Revision as of 08:23, 3 August 2009 by rosettacode>Dmitry-kazakov (Associative arrays are not always ordered)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Hmm, associative array is not defined ordered. It is an unordered map. For example, it can have keys of complex numbers or images etc, which are unordered. Whether and if an associative array has some internal indices, different from the unordered keys, of full or partial order making indexation better than O(n) is an implementation detail. I tempted to suggest renaming to iteration over an ordered map, but looking at the implementations, I realized that it is rather an ordered view of some unordered map using an alternative ordered key. Any container can have such alternative views. It is not special to associative array, or better to say has nothing to do with them. --Dmitry-kazakov 08:23, 3 August 2009 (UTC)