May 10, 2015 Comparing variants | ||||
|---|---|---|---|---|
| ||||
Comparing integer signed and unsigned variants will result in error:
import std.variant;
void main()
{
auto a = 11;
auto b = 10u;
assert(a > b);
Variant va = 11;
Variant vb = 10u;
assert(va > vb); //error
}
std.variant.VariantException@std/variant.d(1309): Variant: attempting to use incompatible types int and uint
Is this intended behaviour? I'm asking because the rest of arithmetic/equality operations are working as expected, only opCmp throws.
| ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply