Template baseInterface

Deduces single base interface for a type. Multiple interfaces will result in compile-time error.

Arguments

template baseInterface(T);

Parameters

NameDescription
T interface or class type

Returns

T if it is an interface. If T is a class, interface it implements.

Example

interface I1 { }
class A : I1 { }
interface I2 { }
class B : I1, I2 { }

static assert (is(baseInterface!I1 == I1));
static assert (is(baseInterface!A == I1));
static assert (!is(typeof(baseInterface!B)));

Authors

Sönke Ludwig, Михаил Страшун

Copyright

© 2012 RejectedSoftware e.K.

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.