Pointer, if pointed type is unknown?

Nobody via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Aug 3 04:19:42 PDT 2014


On Saturday, 2 August 2014 at 20:21:37 UTC, seany wrote:
> In my previous post 
> (http://forum.dlang.org/thread/jcaomfduqeofobculgli@forum.dlang.org) 
> I asked for an array of pointers to different types, as a stack 
> for my own, where I can generate and insert runtime variables.
>
> However, seems like I need to know the type of variable the 
> pointer is pointing to. That is,
>
> double pi = 3.14159;
> size_t ptr = cast(ulong)π // so far oky
>
> double pi_2 = *ptr; // this is where things break down
>
> won't work.
>
> What can I do if the type of the variable is not known?

I there is a sort of data structure then you can use a type tuple 
as a map, used to interpret your pointers. However it relies on 
the context.



More information about the Digitalmars-d-learn mailing list