const challenge
Derek Parnell
derek at psych.ward
Mon Feb 4 12:54:52 PST 2008
On Mon, 4 Feb 2008 10:01:06 -0500, Steven Schveighoffer wrote:
> I just tested this out in D 2.006, and you are correct. a1 ~ "\n" results
> in a char[]. I think when I was porting the code, it looked more like:
>
> a1 ~ '\n';
>
> which results in a const(char)[].
>
> So the example I gave originally is invalid, but the point is not. The
> result of concatenation should be determined by the usage of the result, and
> allowed if it doesn't break constness.
Yes, and another point is why does the compiler treat
string ~ char
and
string ~ string
differently!?
--
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell
More information about the Digitalmars-d
mailing list