blob: 97b03024d99d5a87b4958a61bc305a3bb5b481ec (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
map enum to field offsets (or create enum from field)
typedef Person = (
string^ first,
string^ last,
string^ address,
);
// alternative 1: create enum from struct (or map it)
typedef FieldType = enum for Person;
typedef FieldType = enum int for Person;
typedef FieldType = enum int (first, last, address) for Person;
// alternative 2: array that maps things to field offsets
(string^, fieldof(Person))#[] fieldMap = [
("First name", :first),
("Last name", :last),
("Address", :address),
];
|