dummy question : runtime type testing...

Mike Wey mike-wey at example.com
Sat Jun 18 03:34:48 PDT 2011


On 06/18/2011 05:28 AM, Lloyd Dupont wrote:
> ho... easy hey!
> but how about the other 2 test I'd like be able to run?
>
> bool isTypeOf(T)(TypeInfo ti) { "return T is ti" }
> bool isTypeOf(TypeInfo ti1, TypeInfo ti2) { "return ti1 is ti2" }
>

bool isTypeOf(T)(TypeInfo ti)
{
     return ( typeid(T) is ti );
}

bool isTypeOf(TypeInfo ti1, TypeInfo ti2)
{
     return ( ti1 is ti2 );
}

-- 
Mike Wey


More information about the Digitalmars-d-learn mailing list