Tuple

$(D_PSYMBOL Tuple) can store two or more heterogeneous objects.

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.

Members

Aliases

ChooseType
alias ChooseType(alias T) = T.Seq[0]
Undocumented in source.
ParsedSpecs
alias ParsedSpecs = parseSpecs!(0, Specs)
Undocumented in source.

Structs

Tuple
struct Tuple
Undocumented in source.

Templates

parseSpecs
template parseSpecs(size_t fieldCount, Specs...)
Undocumented in source.

Parameters

Specs

Field types and names.

Examples

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");

See Also

$(D_PSYMBOL tuple).

Meta