Order of object fields

Steven Schveighoffer schveiguy at gmail.com
Thu Jan 27 13:13:34 UTC 2022


On Thursday, 27 January 2022 at 12:45:20 UTC, frame wrote:
> Is the order of fields guaranteed returned by `.tupleof` and 
> `__traits(getMember,...)`, can I rely on this? I know that are 
> different things, I mean just per each use case if I have more 
> functions that traverses through all fields. Thx.

Not for classes. The compiler is free to reorder if it wants to.

Yes for structs.

-Steve


More information about the Digitalmars-d-learn mailing list