tango.core.Traits

The traits module defines tools useful for obtaining detailed compile-time information about a type. Please note that the mixed naming scheme used in this module is intentional. Templates which evaluate to a type follow the naming convention used for types, and templates which evaluate to a value follow the naming convention used for functions.

Members

Functions

ctfe_i2a
char[] ctfe_i2a(long i)
char[] ctfe_i2a(uint i)

compile time integer to string

ctfe_i2a
char[] ctfe_i2a(int i)
char[] ctfe_i2a(ulong i)

compile time integer to string

Templates

BaseTypeOf
template BaseTypeOf(T)

Strips the qualifiers from a type

BaseTypeOfArrays
template BaseTypeOfArrays(T)

Strips the []'s off of a type.

BaseTypeTupleOf
template BaseTypeTupleOf(T)

Evaluates to a tuple representing the ancestors of T. T is required to be a class or interface type.

ComplexTypeOf
template ComplexTypeOf(T)

complex type for the given type

DynamicArrayType
template DynamicArrayType(T)

is T is static array returns a dynamic array, otherwise returns T

ElementTypeOfArray
template ElementTypeOfArray(T : T[])

strips one [] off a type

ExprTypeOf
template ExprTypeOf(Expr)

Returns the type that a T would evaluate to in an expression. Expr is not required to be a callable type

ImaginaryTypeOf
template ImaginaryTypeOf(T)

imaginary type for the given type

InoutTypeOf
template InoutTypeOf(T, M)

Computes the effective type that inout would have if you have it two parameters of difference constness

KeyTypeOfAA
template KeyTypeOfAA(T)

type of the keys of an AA

MaxPrecTypeOf
template MaxPrecTypeOf(T)

type with maximum precision

ParameterTupleOf
template ParameterTupleOf(Fn)

Evaluates to a tuple representing the parameters of Fn. Fn is required to be a callable type.

ParameterTupleOf
template ParameterTupleOf(alias fn)

Evaluates to a tuple representing the parameters of fn. n is required to be callable.

RealTypeOf
template RealTypeOf(T)

real type for the given type

ReturnTypeOf
template ReturnTypeOf(Fn)

Evaluates to the return type of Fn. Fn is required to be a callable type.

ReturnTypeOf
template ReturnTypeOf(alias fn)

Evaluates to the return type of fn. fn is required to be callable.

ValTypeOfAA
template ValTypeOfAA(T)

type of the values of an AA

isArrayType
template isArrayType(T)

true for array types

isAssocArrayType
template isAssocArrayType(T)

Evaluates to true if T is an associative array type.

isAtomicType
template isAtomicType(T)

true if T is an atomic type

isCallableType
template isCallableType(T)

Evaluates to true if T is a function, function pointer, delegate, or callable object.

isCharType
template isCharType(T)

Evaluates to true if T is char, wchar, or dchar.

isComplexType
template isComplexType(T)

Evaluates to true if T is a complex floating-point type.

isDynamicArrayType
template isDynamicArrayType(T)

Evaulates to true if T is a dynamic array type.

isFloatingPointType
template isFloatingPointType(T)

Evaluates to true if T is any floating-point type: real, complex, or imaginary.

isImaginaryType
template isImaginaryType(T)

Evaluates to true if T is an imaginary floating-point type.

isIntegerType
template isIntegerType(T)

Evaluates to true if T is a signed or unsigned integer type.

isPointerType
template isPointerType(T)

Evaluates to true if T is a pointer type.

isPointerType
template isPointerType(T : T*)
Undocumented in source.
isRealType
template isRealType(T)

Evaluates to true if T is a real floating-point type.

isReferenceType
template isReferenceType(T)

Evaluates to true if T is a a pointer, class, interface, or delegate.

isSignedIntegerType
template isSignedIntegerType(T)

Evaluates to true if T is a signed integer type.

isStaticArrayType
template isStaticArrayType(T : T[U], size_t U)

Evaluates to true if T is a static array type.

isStaticArrayType
template isStaticArrayType(T)
Undocumented in source.
isStringType
template isStringType(T)

Evaluates to true if T is char[], wchar[], or dchar[].

isUnsignedIntegerType
template isUnsignedIntegerType(T)

Evaluates to true if T is an unsigned integer type.

rankOfArray
template rankOfArray(T)

Count the []'s on an array type

staticArraySize
template staticArraySize(T)

returns the size of a static array

Meta

License

BSD style: $(LICENSE)

Authors

Sean Kelly, Fawzi Mohamed, Abscissa