how can I ensure that a template instantiation is unique?
Andrea Fontana via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Jun 19 00:26:11 PDT 2014
On Thursday, 19 June 2014 at 05:48:24 UTC, Vlad Levenfeld wrote:
> I'm instantiating a couple of template structs that conflict
> with each other. I'd like them to be unique types,
> automatically. So I tried this:
>
> template Foo (string unique_id = __FILE__~__LINE__.to!string)
> {...}
>
> but it didn't work. When I use this for templated functions, I
> get the file and line number where the function is
> instantiated. But in this case, I got the file and line number
> where the template was defined.
>
> Is there anything I can do to make sure each instantiated type
> is unique?
Maybe something like this:
http://dpaste.dzfl.pl/ce479a2f87f4
More information about the Digitalmars-d-learn
mailing list