Variadic arguments and map

Frank Benoit keinfarbton at googlemail.com
Tue Nov 20 11:44:38 PST 2007


How to access a map from a vararg list.

If the function does process the TypeInfo array and gets an argument
with TypeInfo_AssociativeArray, I don't see a way to access the map
content without writing code, that has knowledge of the internal map
storage. I need to understand how the runtime for AA is implemented, to
access the content.

I used this way ...
1. cast the vararg pointer to some kind of map, e.g. ubyte[ubyte]
2. foreach over the map with inout value
3. get the address of the value => p.
4. It is know, that the key follows the value: p - "used key size" get
the key address
5. Get the value address with adding the size of key from the TypeInfo

Is there a better way? (more portable and less pointer arithmethic)




More information about the Digitalmars-d mailing list