On Friday, 18 September 2015 at 13:53:52 UTC, Nordlöw wrote:
On Friday, 18 September 2015 at 13:22:14 UTC, Nordlöw wrote:
Ideas anyone?
I tried tagging up `VariantN` with pure until I got to
@property inout(T)* peek(T)() inout pure
{
static if (!is(T == void))
static assert(allowed!(T), "Cannot store a " ~
T.stringof
~ " in a " ~ VariantN.stringof);
if (type != typeid(T))
return null;
static if (T.sizeof <= size)
return cast(inout T*)&store;
else
return *cast(inout T**)&store;
}
which then errors as
variant.d(701,13): Error: pure function
'std.variant.VariantN!32LU.VariantN.peek!void.peek' cannot call
impure function 'object.opEquals'
for the line
if (type != typeid(T))
Why is `object.opEquals` not pure?
It's a long story, but it boils down to the simple fact that
nobody's gotten around to it yet. I think the plan was to make it
templated, but Jonathan Davis knows more about it than anyone.