Fast linear search in D array (slice)

Per Nordlöw per.nordlow at gmail.com
Wed Nov 7 21:45:14 UTC 2018


On Wednesday, 7 November 2018 at 21:06:14 UTC, Per Nordlöw wrote:
> - As a special-case of the above there's also the possibility 
> of mutating the last character to be a null and then reusing 
> `strchr`.

Correction it's presumably better to, in place of `strchr`, use

        void *memchr(const void *s, int c, size_t n);

and

        void *rawmemchr(const void *s, int c);

for the sentinel-at-the-end case.

For the non-CTFE case, that is.


More information about the Digitalmars-d mailing list