Struct Tuple

Tuple can store two or more heterogeneous objects.

struct Tuple(Specs...) ;

The objects can by accessed by index as obj[0] and obj[1] or by optional names (e.g. obj.first).

Specs contains a list of object types and names. First comes the object type, then an optional string containing the name. If you want the object be accessible only by its index (0 or 1), just skip the name.

Fields

NameTypeDescription
expand Tuple.TypesRepresents the values of the Tuple as a list of values.

Aliases

NameDescription
Types Field types.

Parameters

NameDescription
Specs Field types and names.

See Also

tuple.

Example

auto pair = Tuple!(int, "first", string, "second")(1, "second");
assert(pair.first == 1);
assert(pair[0] == 1);
assert(pair.second == "second");
assert(pair[1] == "second");