How to obtain Variant underlying type?

anonymouse anany at mouse.com
Mon Jul 11 06:07:23 UTC 2022


On Sunday, 10 July 2022 at 19:14:34 UTC, Paul Backus wrote:
>
> For reference, this is the more correct way:
>
> ```d
> while (cast(TypeInfo_Array) v.type !is null) {
>     Variant elem = v[0];
>     // etc.
> }
> ```
>
> Hard to blame anyone for not coming up with that on their first 
> try, especially since `TypeInfo_Array` is not even 
> documented--you have to read the source of `object.d` to find 
> out about it.

I honestly cannot say why but I was having a problem using this 
earlier. After several hours of frustration, I rebooted the 
computer, went for a run, came back, and tried again. It works!!! 
Thank you very much.

--anonymouse




More information about the Digitalmars-d-learn mailing list