The OpenD Programming Language

Tuple.expand

Use t.expand for a Tuple t to expand it into its components. The result of expand acts as if the Tuple's components were listed as a list of values. (Ordinarily, a Tuple acts as a single value.)

struct Tuple
Types expand;

Examples

auto t1 = tuple(1, " hello ", 'a');
assert(t1.toString() == `Tuple!(int, string, char)(1, " hello ", 'a')`);

void takeSeveralTypes(int n, string s, bool b)
{
    assert(n == 4 && s == "test" && b == false);
}

auto t2 = tuple(4, "test", false);
//t.expand acting as a list of values
takeSeveralTypes(t2.expand);

Meta