Lexicographic comparison of arrays (of chars)

Per Nordlöw per.nordlow at gmail.com
Wed Jan 22 08:30:55 UTC 2020


I've implement a small size optimized `string` at

https://github.com/nordlow/phobos-next/blob/c35fa4052738af0cd7ad39a9fa715b5ec29c7bba/src/nxt/sso_string.d

I'm now wondering whether or not its definition of comparison at

https://github.com/nordlow/phobos-next/blob/c35fa4052738af0cd7ad39a9fa715b5ec29c7bba/src/nxt/sso_string.d#L248

is a suitable definition of `opCmp` for `SSOString` in terms of 
independence of Phobos' `std.algorithm.comparison.cmp`.

I'm asking because comparison of `string`s can be done directly as

     assert("a" < "b")

without any dependence on Phobos.

Is there a builtin definition of array (of `char`) comparison 
defined somewhere in druntime?

Further, does

     "a" < "b"

perform autodecoding of UTF-8 sequences?


More information about the Digitalmars-d-learn mailing list