isSumType

True if T is a SumType or implicitly converts to one, otherwise false.

template isSumType (
T
) {
static if(is(T : SumType!Args, Args...))
enum isSumType;
static if(!(is(T : SumType!Args, Args...)))
static if(is(T == struct) && __traits(getAliasThis, T).length > 0)
enum isSumType;
static if(!(is(T : SumType!Args, Args...)))
static if(!(is(T == struct) && __traits(getAliasThis, T).length > 0))
enum isSumType;
}

Examples

static struct ConvertsToSumType
{
	SumType!int payload;
	alias payload this;
}

static struct ContainsSumType
{
	SumType!int payload;
}

assert(isSumType!(SumType!int));
assert(isSumType!ConvertsToSumType);
assert(!isSumType!ContainsSumType);

Meta