How to test templates for equality?
Uranuz via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Jul 6 22:27:29 PDT 2014
> In this particular case, the only solution I know of is an
> awful hack:
> using .stringof and __traits(identifier, x) and then parse the
> strings:
>
> "Name!(int, double[string])" and "Name(T, U[V], U, V)"
>
> and then the fun begins: in the general case, you must then
> equate the
> arguments lists (recursively).
>
> Philippe
Yes. This is possible solution but looks very complicated. For
now I changed it for struct template. But there are could be some
cases where you don't want to make it class or struct
(theoreticaly). If someone else experience the same problem, so
may be new __traits(...) needs to be proposed. We have the only
trait isSame that helps working with templates. May be we could
add trait that will help get template arguments list for
instantiated template. I think it could be useful.
More information about the Digitalmars-d-learn
mailing list