How to simulate a new type

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu May 14 18:38:56 PDT 2015


On Friday, 15 May 2015 at 01:03:32 UTC, Charles Hixson wrote:
> Yes, that looks as if it would do the job, but what are its 
> advantages over a simple struct?

None really, except perhaps automatic forwarding of operators 
which is easy enough to do on a struct too (and with a struct, 
you can do only the ones that actually make sense for you).

Typedef has a few major disadvantages too - surprising behavior 
if you forget the second parameter, for example. The library 
typedef should really be removed.


More information about the Digitalmars-d-learn mailing list