isAssignable

Returns true iff a value of type Rhs can be assigned to a variable of type Lhs.

isAssignable returns whether both an lvalue and rvalue can be assigned.

If you omit Rhs, isAssignable will check identity assignable of Lhs.

enum isAssignable (
Lhs
Rhs = Lhs
)

Examples

static assert( isAssignable!(long, int));
static assert(!isAssignable!(int, long));
static assert( isAssignable!(const(char)[], string));
static assert(!isAssignable!(string, char[]));

// int is assignable to int
static assert( isAssignable!int);

// immutable int is not assignable to immutable int
static assert(!isAssignable!(immutable int));

Meta