Kagamin wrote:
Robert Jacques Wrote:
Should be Algebraic!(T, void). If that doesn't currently compile, we
should make it compile.
Andrei
For what it's worth, both Algebraic!(T, void*) and Algebraic!(T, void)
compile on my branch of std.variant.
can't assign null
alias Algebraic!(int,void) nint;
nint n1=5;
assert(n1==5);
n1=null;
\std\variant.d:497: Error: static assert "Cannot store a void* in a
VariantN!(maxSize,int,void). Valid types are (int, void)"
test.d:45: instantiated from here: opAssign!(void*)
Yes, compiler qualifies null as void*.
I was playing with void* version few weeks ago and I can confirm that
both assignment and equality testing works for nulls.
One thing I missed was lack of conversion to string "null". For example
array of Algebraic!(int, void*) was printed as [0, 0, 2], when element 1
was null. I think it should rather be [0, null, 2].