How to simulate a new type

Charles Hixson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu May 14 23:10:20 PDT 2015



On 05/14/2015 06:38 PM, Adam D. Ruppe via Digitalmars-d-learn wrote:
> 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.
>
Thank you.  I was hoping that struct was a good approach, I've just 
never seen anyone recommending it, so I wanted to check.


More information about the Digitalmars-d-learn mailing list