Comparing variants
    rumbu via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Sun May 10 00:31:45 PDT 2015
    
    
  
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 at 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.
    
    
More information about the Digitalmars-d-learn
mailing list