Shouldn't hasSwappableElements work on char arrays?
Andrej Mitrovic
andrej.mitrovich at gmail.com
Thu Feb 24 12:26:54 PST 2011
On 2/24/11, Steven Schveighoffer <schveiguy at yahoo.com> wrote:
>
> A string literal is immutable, dchar[] is mutable. These should work:
>
> immutable(dchar)[] test = "test";
> dstring test = "test";
> auto test = "test"d;
Ah right, the postfix form. That's what i was looking for. I know a
literal is immutable, I've tried
"test".dup, but it still complained that it's not of type dchar. Anywho..
> wait, you thought char[] was an array? You poor poor soul ;)
Yes. And you know what's going to happen next, right? Everyone is
going to create their own implementation of a string type because of
these non-issues. Happens in C/C++ all the time, I see it in almost
every mid-large codebase out there.
But w/e, strings are perfect in D etc etc..
More information about the Digitalmars-d
mailing list