Shouldn't hasSwappableElements work on char arrays?
Steven Schveighoffer
schveiguy at yahoo.com
Thu Feb 24 12:50:56 PST 2011
On Thu, 24 Feb 2011 15:33:52 -0500, Andrej Mitrovic
<andrej.mitrovich at gmail.com> wrote:
> On 2/24/11, Jonathan M Davis <jmdavisProg at gmx.com> wrote:
>> "test" _is_ immutable, so assigning it to a dchar[] without
>> duping it is bad anyway).
>
> Can't the compiler figure that out on its own?
It did figure that out (that it was bad) and told you not to do it :)
But what you are asking is for the compiler to implicitly dup it. I have
thought this might be good to have in the past as well, but it's also not
too bad to have to type "test"d.dup. So while having the compiler save
you a bit of typing would be good, it's not the end of the world to
require it.
-Steve
More information about the Digitalmars-d
mailing list