Module mecca.lib.reflection

Various utilities for hacking the D type system

Functions

NameDescription
as(func) Execute a given piece of code while casting it:
bitEnumToString(val) Convert a value to bitwise or of enum members
funcAttrToString(attr) Return a FunctionAttribute converted to a mixinable string
genMoveArgument(numArgs, callString, argumentString, ret) A CTFE function for generating a mixin string of a function call moving arguments

Structs

NameDescription
Closure Non-GC postponed function call with arguments (closure)

Templates

NameDescription
CopySignature CTFE template for genering a string for mixin copying a function's signature along with its default values

Manifest constants

NameTypeDescription
isRefInputRange Returns true if R is a pseudo input range with ref return.

Aliases

NameTypeDescription
CapacityType ubyte Return the smallest type large enough to hold the numbers 0..n
ForeachTypeof ReturnType!((){foreach(x;TU.init){returnx;}assert(0);}) Replace std.traits.ForeachType with one that works when the item is copyable or not
PromotedType typeof(Type(0)+Type(0)) Type, unless it is smaller than int, in which case it is promoted