finding composed structs

Tobias Pankrath tobias at pankrath.net
Tue Oct 30 15:09:05 PDT 2012


On Tuesday, 30 October 2012 at 21:02:22 UTC, Dan wrote:
> On Tuesday, 30 October 2012 at 20:17:06 UTC, Tobias Pankrath 
> wrote:
>>
>> Beautiful version: http://dpaste.dzfl.pl/2340d73f
>
> Beautiful indeed. Does the same approach work for generating 
> correct versions of opCmp, assuming arbitrary order by field 
> comparison as ordered in struct?
> Also hashing?
>
> Thanks
> Dan

Dunno, if __traits(allMembers...) enforces any order on its 
result. It looks like DMD does use the definition/declaration 
order, but that's not in any documentation. The opCmp would 
depend on this. You could sort the fields by name for a defined 
order.


More information about the Digitalmars-d-learn mailing list