opCmp on a struct keyed by an array of bytes
bearophile
bearophileHUGS at lycos.com
Tue Nov 12 14:52:50 PST 2013
Ali Çehreli:
> int opCmp(ref const B24 b) const
> {
> return bytes[].cmp(b.bytes[]);
Few months ago I have written a small rant about that. That
little [] at the end of those arrays is not innocuous, it
essentially throws away a very precious compile-time amount of
information: the static length of the arrays. So for the compiler
it becomes much harder to optimize those loops. In my opinion
this is an unacceptable part of the design of Phobos (mostly
std.algorithm).
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list