Bind

Binds template arguments using format string.

  • use %i to refer i-th argument;
  • use %* to refer all arguments;
  • use %% for a % symbol.
mixin template Bind (
string fmt
)

Examples

t
{
	import unstd.traits;

	mixin Bind!q{ CommonTypeToLong = CommonType!(long, %*) };
	static assert(is(CommonTypeToLong!int == long));

	mixin Bind!q{ isImplicitlyConvertibleToInt = isImplicitlyConvertible!(%0, int) };
	static assert(!isImplicitlyConvertibleToInt!long);

	mixin Bind!q{ isImplicitlyConvertibleFromInt = isImplicitlyConvertible!(int, %0) };
	static assert( isImplicitlyConvertibleFromInt!long);

	mixin Bind!q{ UnqualAll = MapTuple!(Unqual, %*) };
	static assert(is(UnqualAll!(const(int), immutable(bool[])) == TypeTuple!(int, immutable(bool)[]))

Meta