Module tanya.meta.trait

Type traits.

Templates in this module are used to obtain type information at compile time.

Enums

NameDescription
FunctionAttribute Attributes can be attached to a function.

Manifest constants

NameTypeDescription
allSameType Determines whether all Types are the same.
classInstanceAlignment Different than T.alignof, which is the same for all class types, classInstanceOf determines the alignment of the class instance and not of its reference.
functionAttributes Retrieves the attributes of the function F.
hasElaborateAssign Determines whether T has an elaborate assign.
hasElaborateCopyConstructor Determines whether T has an elaborate postblit constructor.
hasElaborateDestructor Determines whether T has an elaborate destructor.
hasMember Determines whether T defines a symbol member.
hasStaticMember Determines whether the type T has a static method named member.
hasUDA Determines whether symbol has user-defined attribute attr attached to it.
ifTestable Tests whether pred(T) can be used as condition in an if-statement or a ternary operator.
isAbstractClass Determines whether T is an abstract class.
isAbstractFunction Determines whether T is an abstract method.
isAggregateType Determines whether T is an aggregate type.
isArray Determines whether T is an array type (dynamic or static, but not an associative one).
isAssignable Tests whether a value of type Rhs can be assigned to a variable of type Lhs.
isAssociativeArray Determines whether T is an associative array type.
isBasicType Determines whether T is a basic type.
isBoolean Determines whether T is a boolean type, i.e. bool.
isBuiltinType Determines whether T is a built-in type.
isCallable
isComplex Determines whether T is a complex type.
isCopyable Determines whether the type T is copyable.
isDelegate Delegate stores the function pointer and function context.
isDynamicArray Determines whether T is a dynamic array type.
isEqualityComparable Determines whether values of type T can be compared for equality, i.e. using == or != binary operators.
isExpressions Tells whether Args contains only expressions.
isFinalClass Determines whether T is a final class.
isFinalFunction Determines whether T is a final method.
isFloatingPoint Determines whether T is a floating point type.
isFunction isFunction returns true only for plain functions, not function pointers or delegates. Use isFunctionPointer or isDelegate to detect them or isSomeFunction for detecting a function of any type.
isFunctionPointer Function pointer is a pointer to a function. So a simple function is not a function pointer, but getting the address of such function returns a function pointer.
isImplicitlyConvertible Checks whether From is implicitly (without explicit cast) to To.
isInnerClass Tests whether T is an inner class, i.e. a class nested inside another class.
isInstanceOf Tests whether I is an instance of template T.
isIntegral Determines whether T is an integral type.
isMutable Determines whether T is mutable, i.e. has one of the following qualifiers or a combination of them:
isNarrowString Determines whether T is a narrow string, i.e. consists of char or wchar.
isNested Determines whether T is a nested type, i.e. class, struct or union, which internally stores a context pointer.
isNestedFunction Determines whether T is a nested function.
isNumeric Determines whether T is a numeric (floating point, integral or complex) type.
isOrderingComparable Determines whether values of type T can be compared for ordering, i.e. using >, >=, < or <= binary operators.
isPointer Determines whether T is a pointer type.
isPolymorphicType Determines whether T is a polymorphic type, i.e. a class or an interface.
isScalarType Determines whether T is a scalar type.
isSigned Determines whether T is a signed numeric type.
isSomeChar Determines whether T is a character type.
isSomeFunction
isSomeString Determines whether T is a string, i.e. consists of char, wchar or dchar.
isStaticArray Determines whether T is a static array type.
isType Checks whether T is a type, same as is(T) does.
isTypeTuple Determines whether Args contains only types.
isUnsigned Determines whether T is an unsigned numeric type.
isWideString Determines whether T is a wide string, i.e. consists of dchar.
mangledName Returns the mangled name of the symbol T.
mangledName
mostNegative Returns the minimum value of type T. In contrast to T.min this template works with floating point and complex types as well.
ParameterIdentifierTuple Returns a string array with all parameter names of a function.

Aliases

NameTypeDescription
BaseClassesTuple AliasSeq!() Returns all the base classes of T, the direct parent class comes first, Object ist the last one.
BaseTypeTuple Tuple Returns a tuple of base classes and interfaces of T.
EnumMembers AliasSeq!(__traits(getMember,T,allMembers)) Returns all members of enum T.
evalUDA T If T is a type, constructs its default value, otherwise evalUDA aliases itself to T.
Fields typeof(T.tupleof[0..__dollar-1]) Returns the types of all members of T.
FunctionTypeOf T Determines the type of the callable F.
getUDAs FindUDA!(__traits(getAttributes,symbol)) Returns a compile-time tuple of user-defined attributes (UDA) attached to symbol.
getUDAs AliasSeq!(__traits(getAttributes,symbol))
InterfacesTuple Filter!(isInterface,TransitiveBaseTypeTuple!T) Returns all the interfaces T inherits from.
ParameterDefaults GetDefault!0 Returns a tuple with default values of the parameters to F.
Parameters T Returns a tuple with parameter types of a function.
ReturnType T Determines the return type of the callable F.
TemplateArgsOf Args Returns template parameters of T.
TemplateOf Base Determines the template T is an instance of.
TransitiveBaseTypeTuple NoDuplicates!(Sort!(cmp,Impl!T)) Returns a tuple of all base classes and interfaces of T.