Lexicographical object comparison by selected members of a struct

Alexandru Ermicioi alexandru.ermicioi at gmail.com
Sat Aug 21 05:34:59 UTC 2021


On Saturday, 21 August 2021 at 04:34:46 UTC, Ali Çehreli wrote:
> ...

Consider __traits(identifier, member) instead. This one should 
return member name as string, removing the need of memberName 
function.

Also you could have an annotation @Equality.Include for example, 
and make mixin scan fields for it and include only those fields 
and methods that have it into compariosn and hashing.

Another problem that may arise is storage in local variable of 
fields before comparison, it might introduce unnecessary copy.

Regards,
Alexandru.


More information about the Digitalmars-d-learn mailing list