How to obtain Variant underlying type?
anonymouse
anany at mouse.com
Sat Jul 9 14:36:44 UTC 2022
std.variant;
Variant v = [[1], [2], [3]];
writeln(v.type); // int[][]
typeof(v.type); // TypeInfo
assert(v.type == typeid(int[][]);
As demonstrated by the assert statement, .type returns the typeid
of the underlying type. How would I obtain the actual type such
that:
auto vb = v.base; // what should I put here to achieve the
following:
typeof(vb); // int[][]
assert(vb == [[1], [2], [3]]);
--anonymouse
More information about the Digitalmars-d-learn
mailing list