Variadic arguments and map

Jarrett Billingsley kb3ctd2 at yahoo.com
Tue Nov 20 12:17:10 PST 2007


"Frank Benoit" <keinfarbton at googlemail.com> wrote in message 
news:fhvdep$1pe5$1 at digitalmars.com...
> 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)
>

This looks like how std.format does it too.. 





More information about the Digitalmars-d mailing list