expressionTuple

Creates an expression tuple out of a sequence of zero or more expressions. Same as GenericTuple, except it contains only expressions.

template expressionTuple (
expressions...
) if (
isExpressionTuple!expressions
) {}

Members

Aliases

expressionTuple
alias expressionTuple = expressions
Undocumented in source.

Examples

t
{
	alias expressions = expressionTuple!(5, 'c', "str");

	typeof(expressions[0]) myVar = expressions[1]; // same as `int myVar = 5;`
	auto str = expressions[2]; // same as `auto str = "a string";`

	void foo(out typeof(expressions[0 .. 2]) args)  // same as `int foo(out int, out char)`
	{
		args[0] = expressions[0] * 2; // same as `5 * 2`
		args[1] = expressions[1] + 1; // same as `'c' + 1`
	}

	void main()
	{
		int i;
		char c;
		foo(i, c);
		assert(i == 10 && c == 'd');
	}

	version(none)
	alias badExpressionTuple = expressionTuple!(int, 5); // error: not an expression tup

Meta