On Thursday, 20 September 2012 at 15:04:48 UTC, Namespace wrote:
On Thursday, 20 September 2012 at 14:15:23 UTC, monarch_dodra
wrote:
On Thursday, 20 September 2012 at 14:09:29 UTC, Namespace
wrote:
http://dpaste.dzfl.pl/edit/361a54eb
With
[code]
@disable this(this);
[/code]
this don't work (as expected). But with the copy ctor but
without ".get" you earn a segmentation fault (as you can
see). So you can disable the copy ctor but without using .get
you're not get what you want. Even with scoped, but scoped's
getter name is too long.
Wrong link.
Try this: http://dpaste.dzfl.pl/9247af54
What did you expect? You are passing your OnStack by value. In
this particular case, you are over destroying your OnStack!B,
which in turn over destroyes his _a.
Reactivate the disable, and you'll see the problem blatantly:
http://dpaste.dzfl.pl/9e873033
/home/c192/c104.d(102): Error: struct c104.OnStack!(A).OnStack is
not copyable because it is annotated with @disable
The "problem" with implicit cast is that *sometimes* you think it
does it, but in fact, it doesn't. Here, it didn't.
The opCall expects Arg... so if you give it an OnStack, it
accepts an OnStack. If you want it to take a T, you have to
specify it, either in the template, or with get, or with a cast.
Here is a cast version, with this(this) disabled:
http://dpaste.dzfl.pl/837f44a9