Traits

Jacob Carlborg doob at me.com
Fri Oct 11 02:37:32 PDT 2013


On 2013-10-11 07:49, luminousone wrote:

> import std.traits;
>
> bool ChildInheritsFromParent( parent, child )( ) {
>
>      foreach ( k, t; BaseClassesTuple!child ) {
>          if( typeid(t) == typeid(parent) )
>              return true;
>      }
>      return false;
> }

That will perform a runtime check and not a compile time check.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list