Suffix-based literal syntax

Reiner Pope some at address.com
Wed May 30 14:52:57 PDT 2007


Reiner Pope wrote:
> I envisage a usage something like this:
> 
> struct LengthKM { ... }
> alias LengthKM.opCall opSuff_km;
> // Of course this would actually be auto generated by a template, but 
> still...

Oh, and you might want:

struct Length {...}

Length opSuff_km(real r) { return Length(1000, r); }
Length opSuff_m(real r) { return Length(1, r); }
Length opSuff_mm(real r) { return Length(0.001, r); }



More information about the Digitalmars-d mailing list