Tuples: .tupleof property
Get acquainted with the .tupleof property of tuples.
We'll cover the following...
.tupleof
property
.tupleof
represents the members of a type or an object. When applied to a user- defined type, .tupleof
provides access to the definitions of the members of that type:
Press + to interact
import std.stdio;struct S {int number;string message;double value;}void main() {foreach (i, MemberType; typeof(S.tupleof)) {writefln("Member %s:", i);writefln(" type: %s", MemberType.stringof);string name = S.tupleof[i].stringof;writefln(" name: %s", name);}}
S.tupleof
appears in two ...