~= call copy ctor?
Namespace
rswhite4 at googlemail.com
Fri Jul 20 09:02:17 PDT 2012
If i @disable the postblit i get a strange behaviour:
[code]
struct Test {
public:
int _id;
this(int i) {
_id = i;
writeln("CTOR");
}
@disable
this(this);
~this() {
writeln("DTOR");
}
}
void main() {
Test[] _arr;
_arr ~= Test(42);
writeln(_arr[0]._id);
writeln("end main");
}
[/code]
prints:
CTOR
DTOR
42
end main
The DTor is called _before_ i write Test's id but i can still
print the correct id.
Implicit Copy CTor? ;)
More information about the Digitalmars-d-learn
mailing list