Jérôme Raulin on Tue, 23 Apr 2019 22:18:00 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Iterating over a map content


Hi,

Is there a better way of iterating over an entire map content than something
like :

	map = Map();
	\\ Do stuff with map
	mapkeys = Vec(map);
	for (i = 1, # mapkeys,
		key = mapkeys[i];
		value = mapget(map, key);
		\\ Do other stuff with (key, value)
	);

There is at least two issues with this implementation :
* Storage duplication, keys are stored in both map and mapkeys.
* Access performance, all values are looked up from standard map access.

Thanks very much.

Regards

Jerome