On Thursday, 12 April 2018 at 17:09:22 UTC, Shachar Shemesh wrote:
On 12/04/18 18:42, Uknown wrote:
On Thursday, 12 April 2018 at 12:16:53 UTC, Shachar Shemesh wrote:
[...]


The problem seems to be that cast is happening at compile time, as opposed to run time, as you might have already figured out. Do you need to really do this cast at compile time? I tried running the snippet you gave here: https://run.dlang.io/is/im19nL

Is this how you intend for it to be used? Then there's no need for compile time casts. If not, could you give an example of how `NoCopy` would be used?

struct Disabled {
  int i = 17;

  @disable this(this);
}

struct Container {
  NoCopy!Disabled disabled;
}

Any instance you create of "Container" will have i initialized to 0 by default.

Since `T` has the postblit disabled, I'm guessing the ctor should take a `ref T`.

Since `T` has the postblit disabled, I'm guessing the ctor should take a `ref T`.


Reply via email to