UnaryTemplate

Create template from a string Pred. If Pred isn't a string, alises itself to Pred.

If argumentsCount is -1 created template will accept any number of arguments, otherwise it will expect argumentsCount arguments.

If EnumType is void created template may be an alias or an enum, otherwise it will be an enum of type EnumType.

Created template can access its aruments as a generic tuple with Args.

If argumentsCount is 1 or 2 created template can access its first argument with a if it is an value, with T if it is a type and with A otherwise.

If argumentsCount is 2 created template can access its second argument with b if it is an value, with U if it is a type and with B otherwise.

UnaryTemplate is a convinient way to create a template with one argument (argumentsCount is 1).

BinaryTemplate is a convinient way to create a template with two arguments (argumentsCount is 2).

  1. template Template(alias Pred, int argumentsCount, EnumType = void)
  2. alias UnaryTemplate(alias Pred, EnumType = void) = Template!(Pred, 1, EnumType)
    alias UnaryTemplate(alias Pred, EnumType = void) = Template!(Pred, 1, EnumType)
  3. alias BinaryTemplate(alias Pred, EnumType = void) = Template!(Pred, 2, EnumType)

Examples

t
{
	static assert(Inst!(UnaryTemplate!`__traits(isUnsigned, T)`, uint));
	static assert(is(Inst!(UnaryTemplate!`T[]`, int) == int[]));
	static assert(Inst!(UnaryTemplate!`a == 5`, 5));
	static assert(Inst!(BinaryTemplate!`a == 1 && b == 2`, 1, 2));
	static assert(Inst!(BinaryTemplate!`a + U.sizeof`, 1, int) == 5);
	static assert(PackedGenericTuple!(Inst!(Template!(`Args`, -1), "x", int)).equals!("x", int)

Meta