On Wednesday, March 20, 2013 20:15:46 Dan wrote:
> On Wednesday, 20 March 2013 at 19:01:27 UTC, Jonathan M Davis
>
> wrote:
> > Why are you casting? The cast shouldn't be necessary, because
> > you're doing the
> > initialization inside a static constructor.
>
> Without it I get:
> Error: mutable
On Wednesday, 20 March 2013 at 19:01:27 UTC, Jonathan M Davis
wrote:
Why are you casting? The cast shouldn't be necessary, because
you're doing the
initialization inside a static constructor.
Without it I get:
Error: mutable method cmap.S.__postblit is not callable using a
const object
Error
Dan:
this(this) { x = x.dup; }
I think this(this) doesn't work well with const.
cast(S[string])m = [ "foo" : S(['a']) ];
I think I have never seen code like that. What's the meaning? :-)
(Also if you remove that cast then dmd gives bad error messages
with no line numbers:
Error:
On Wednesday, March 20, 2013 19:41:00 Dan wrote:
> The following works and is the only way I have found to
> initialize m.
> Unfortunately it requires the cast.
>
> Is this safe to do?
> Is there a better way?
> Is this a bug or are future features coming to clean it up?
>
> Thanks
> Dan
>
> ---
The following works and is the only way I have found to
initialize m.
Unfortunately it requires the cast.
Is this safe to do?
Is there a better way?
Is this a bug or are future features coming to clean it up?
Thanks
Dan
--
import std.stdio;
struct S {
this(thi