On Thursday, 20 September 2012 at 14:02:01 UTC, monarch_dodra
wrote:
On Thursday, 20 September 2012 at 12:32:03 UTC, Namespace wrote:
So I should disable the copy ctor (@disable this(this)) and
drop move, right?
Yes, but at that point, what you have is scoped!T
re-implemented :/
As you can See if I pass a OnStack to function/class i'm using
.get all the Time.
You could "alias get this". This way, your OnStack will call
cast as a T implicitly. Again, this is what scoped!T does.
The only other method IMO would be to pass it as OnStack by
value and Store it in the other class also as OnStack, right?
Yes, but that would require a copy contructor "this(this)",
which we have actually ruled out. You can pass the T itself
thanks to the implicit cast to T, but you can't pass an actual
OnStack object.
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.