On Tue, Aug 01, 2017 at 06:46:17PM -0400, Steven Schveighoffer via 
Digitalmars-d wrote:
> On 8/1/17 6:17 PM, Moritz Maxeiner wrote:
[...]
> > import std.algorithm;
> > // I probably wouldn't even define this but use the body as is
> > auto strnlen_safe(in char[] str)
> > {
> >      return countUntil(cast(ubyte[]) str, '\0');
> > }
> 
> Oh that cast.... it irks me so.
[...]

Welcome to the wonderful world of autodecoding. :-D

OTOH, we could just use byCodeUnit and we wouldn't need the cast, I
think. 


T

-- 
Don't get stuck in a closet---wear yourself out.

Reply via email to