xxxxxxxxxx
struct S {
this(this);
this(int i) {}
}
struct Container(T) {
T value;
this(T value) {
import std.algorithm.mutation : move;
this.value = move(value);
}
import std.traits : isCopyable;
static if (isCopyable!T) {
this(ref T value) {
this.value = value;
}
}
}
void main()
{
auto a = Container!S(S(3)); // ok, rvalue is moved
S s = S(3);
auto b = Container!S(s); // error, can't copy an S
}