Reintroduce isStruct, isClass and isInterface
since they can be useful for generic programming.
This commit is contained in:
parent
7e7bf40f70
commit
9e16d84f9e
@ -275,13 +275,37 @@ enum bool isTemplate(alias T) = __traits(isTemplate, T);
|
|||||||
static assert(!isTemplate!(S!int));
|
static assert(!isTemplate!(S!int));
|
||||||
}
|
}
|
||||||
|
|
||||||
deprecated("Use is(T == interface) instead")
|
/**
|
||||||
|
* Tests whether $(D_PARAM T) is an interface.
|
||||||
|
*
|
||||||
|
* Params:
|
||||||
|
* T = A type.
|
||||||
|
*
|
||||||
|
* Returns: $(D_KEYWORD true) if $(D_PARAM T) is an interface,
|
||||||
|
* $(D_KEYWORD false) otherwise.
|
||||||
|
*/
|
||||||
enum bool isInterface(T) = is(T == interface);
|
enum bool isInterface(T) = is(T == interface);
|
||||||
|
|
||||||
deprecated("Use is(T == class) instead")
|
/**
|
||||||
|
* Tests whether $(D_PARAM T) is a class.
|
||||||
|
*
|
||||||
|
* Params:
|
||||||
|
* T = A type.
|
||||||
|
*
|
||||||
|
* Returns: $(D_KEYWORD true) if $(D_PARAM T) is a class,
|
||||||
|
* $(D_KEYWORD false) otherwise.
|
||||||
|
*/
|
||||||
enum bool isClass(T) = is(T == class);
|
enum bool isClass(T) = is(T == class);
|
||||||
|
|
||||||
deprecated("Use is(T == struct) instead")
|
/**
|
||||||
|
* Tests whether $(D_PARAM T) is a struct.
|
||||||
|
*
|
||||||
|
* Params:
|
||||||
|
* T = A type.
|
||||||
|
*
|
||||||
|
* Returns: $(D_KEYWORD true) if $(D_PARAM T) is a struct,
|
||||||
|
* $(D_KEYWORD false) otherwise.
|
||||||
|
*/
|
||||||
enum bool isStruct(T) = is(T == struct);
|
enum bool isStruct(T) = is(T == struct);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user