Can I convert the Range returned by asUpperCase to ubyte[]?

Dr.No jckj33 at gmail.com
Tue May 1 20:13:41 UTC 2018


I'm trying to do an optimization here: a hash function which 
expect a ubye[] array as argument, would just work if I cast 
string to ubyte[] but I need to convert it to upper case, so I'd 
like to do that lazily, so that the byte is converted to its 
upper case version soon as it's requested. I'm not sure if this 
possible because I think the function should also work with Range 
and not ubyte[] to work.

So, adding some code example, can I convert the string to upper 
case then convert it to ubyte[] without memory allocation? 
something like this:


import xxhash;
import std.uni : asUpperCase;
uint hash = xxhashOf(cast(ubyte[])(word.asUpperCase));


More information about the Digitalmars-d-learn mailing list