Extract template parameter at runtime?

Baz via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jun 15 11:53:29 PDT 2015


On Monday, 15 June 2015 at 18:10:34 UTC, Yuxuan Shui wrote:
> Can is() operate on TypeInfo?

yes, you can compare instance of TypeInfo using is or '==' too, 
using typeid which
is returns at run-time the TypeInfo of the argument:

---
void main()
{
     assert(typeid(2) == typeid(1));
     assert(typeid(2) is typeid(1));
     Object a = new Object;
     Object b = new Object;
     assert(typeid(b) is typeid(a));
}
---




More information about the Digitalmars-d-learn mailing list