Creating a new type, to get strong-ish type checking and restrict usage to certain operations, using struct perhaps

Cecil Ward via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jul 21 11:49:21 PDT 2017


I was think about how to create a new type that holds packed bcd 
values, of a choice of widths, that must fit into a uint32_t or a 
uint64_t (not really long multi-byte objects). I am not at all 
sure how to do it. I thought about using a templated struct to 
simply wrap a uint of a chosen width, and perhaps use alias this 
to make things nicer.



More information about the Digitalmars-d-learn mailing list