Template unique IDs per type

Roderick Gibson kniteli at gmail.com
Thu Jul 11 21:18:57 PDT 2013


On Friday, 12 July 2013 at 03:56:50 UTC, JS wrote:
> sure, each type name is unique. All you have to do is convert 
> them to an int... use a hash or some other method or just use 
> the string names. If you need the id's to be continuous try to 
> use an set(array) of the type names. Not sure if the last 
> method works well with ctfe's though.

Hmm, I think in my case I may need them to be sequential from 0 
(though order doesn't matter). I'm beginning to think it just 
isn't possible, as there is no way to store state during 
compilation, and thus no way to "count" how far along we are in 
ids.

I'm not sure what you mean by "try to us an set(array) of type 
names".


More information about the Digitalmars-d-learn mailing list