Tuples: tuple()
Explore the concept of tuples in D programming, including how to create tuples with tuple(), access members by index or property, expand members for function calls, and use tuples to return multiple values. This lesson helps you understand versatile data handling techniques for advanced D development.
Tuples
Tuples are for combining multiple type values to be used as a single object. They are implemented as a library feature by the Tuple template from the std.typecons module.
Tuple makes use of AliasSeq from the std.meta module for some of its operations.
Tuple and tuple()
Tuples are usually constructed by the convenience function tuple():
The tuple call above constructs an object that consists of the int value 42 and the string value hello. The output of the program includes the type of the tuple object and its members.
The tuple type above is the equivalent of the following pseudo struct definition and likely has been ...