opCmp on a struct keyed by an array of bytes

bearophile bearophileHUGS at lycos.com
Tue Nov 12 16:47:29 PST 2013


Charles Hixson:

> I had tried "return bytes.cmp(b.bytes);" , but it didn't occur 
> to me that the error meant I should have used a copy?  Does 
> this syntax mean that what's being compared is a dynamic array 
> copy of the original static array?

They are not copies, just slices. In case of doubts take a look 
at the generated assembly.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list