Can you move a disabled this struct in to a container type if it's an rvalue?

Paul Backus snarwin at gmail.com
Wed Dec 12 21:11:38 UTC 2018


On Wednesday, 12 December 2018 at 20:05:18 UTC, aliak wrote:
> Ie:
>
> struct S {
>     @disable this();
>     this(int i) {}
> }
>
> struct Container(T) {
>     T value;
>     this(auto ref T value) {
>         this.value = value;
>     }
> }
>
> void main() {
>     auto a = Container!S(S(3)); // can't do this.
> }

The only error I get when I compile this has to do with incorrect 
use of `auto ref`. If I change the constructor's signature to 
`this()(auto ref T value)`, it works fine.


More information about the Digitalmars-d-learn mailing list