On Wednesday, 27 July 2016 at 13:09:07 UTC, Liam McSherry wrote:
Since it isn't mentioned in the documentation, do
`std.traits.Fields(T)` and `std.traits.FieldNameTuple(T)`
return the fields and field names in a deterministic order?
Further, will they return the fields/field names in the same
order? That is, will `fields[0]` be the type of
`field_names[0]`?
I think you should be safe here as Fields is basically a wrapper
around T.tupleof, which should always return fields in the same
order. It's not guaranteed anywhere, but it's highly unlikely to
change.
Since FieldNameTuple is also implemented using T.tupleof, you
*can* expect Fields!T[0] to be the type of FieldNameTuple!T[0].
Again, however, this is an implementation detail that is unlikely
to change but is not guaranteed.