digitalmars.D.learn - Implicit conversion of string to array of immutable ubytes
- Per =?UTF-8?B?Tm9yZGzDtnc=?= (2/2) Mar 22 Why doesn't string implicitly convert to immutable(ubyte)[] in
- Jonathan M Davis (9/11) Mar 22 Why would it? They're different types. Their elements happen to have the
Why doesn't string implicitly convert to immutable(ubyte)[] in safe mode?
Mar 22
On Saturday, March 23, 2024 12:11:15 AM MDT Per Nordlöw via Digitalmars-d- learn wrote:Why doesn't string implicitly convert to immutable(ubyte)[] in safe mode?Why would it? They're different types. Their elements happen to have the same size, but that doesn't mean that they're used for the same thing at all. And having them be implicitly convertible could cause serious problems with overloading. If you want to do that conversion without a cast, then you can just use std.string.representation (which will do the cast internally). - Jonathan M Davis
Mar 22