How to simulate a new type

Laeeth Isharc via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu May 14 13:42:20 PDT 2015


On Thursday, 14 May 2015 at 18:42:56 UTC, Charles Hixson wrote:
> What are the downsides to simulating a new type with a struct.
>
> What I have in mind is something along the lines of:
>
> struct myType
> {  uint64_t  value;
> }
>
> The goal of this type is to prevent accidental conversions from 
> myType into ints, uint64_ts, etc.

http://dlang.org/phobos/std_typecons.html#.Typedef


More information about the Digitalmars-d-learn mailing list