isSerialisable

Eponymous template bool of whether a variable can be treated as a mutable variable, like a fundamental integral, and thus be serialised.

Currently it does not support static arrays.

template isSerialisable (
alias sym
) {
static if(!isType!sym)
enum isSerialisable;
static if(!(!isType!sym))
enum isSerialisable;
}

Members

Imports

isSomeFunction (from std.traits)
public import std.traits : isSomeFunction;
Undocumented in source.
isType (from std.traits)
public import std.traits : isType;
Undocumented in source.

Parameters

sym

Alias of symbol to introspect.

Examples

int i;
char[] c;
char[8] c2;
struct S {}
class C {}
enum E { foo }
E e;

static assert(isSerialisable!i);
static assert(isSerialisable!c);
static assert(!isSerialisable!c2); // should static arrays pass?
static assert(!isSerialisable!S);
static assert(!isSerialisable!C);
static assert(!isSerialisable!E);
static assert(isSerialisable!e);