On 9/18/15 9:53 AM, 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?

What about type !is typeid(T)?

This should solve most cases.

-Steve

Reply via email to