Define an order for allMembers traits
Adam D Ruppe
destructionator at gmail.com
Wed Aug 23 16:52:36 UTC 2023
On Wednesday, 23 August 2023 at 13:53:30 UTC, Andrey Zherikov
wrote:
> ```d
> struct Params
> {
> @PositionalArgument(0)
> string firstName;
>
> @PositionalArgument(1)
> string middleName;
>
> @PositionalArgument(2)
> string lastName;
> }
> ```
tbh I actually prefer this code to the alternative
> If `allMembers` guarantees the order to be the same as the
> members are declared then the code above can be simplified to
> this:
but yeah, what others say about the tuple thing is prolly the
best thing by spec
tho in practice allMembers is in order but relying on that might
lead to troube some random day
More information about the Digitalmars-d
mailing list