Re: Arrays and non-copyable elements

2020-06-07 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/7/20 10:07 PM, Stanislav Blinov wrote: On Monday, 8 June 2020 at 00:31:10 UTC, Steven Schveighoffer wrote: This is a bug, please file. What is likely happening is that the template is not moving the data to the underlying C call. That is not a bug, it's a shortcoming of garbage-collect

Re: Arrays and non-copyable elements

2020-06-07 Thread Stanislav Blinov via Digitalmars-d-learn
On Monday, 8 June 2020 at 00:31:10 UTC, Steven Schveighoffer wrote: This is a bug, please file. What is likely happening is that the template is not moving the data to the underlying C call. -Steve That is not a bug, it's a shortcoming of garbage-collected arrays. D arrays are not equipped

Re: Arrays and non-copyable elements

2020-06-07 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/7/20 7:25 PM, Jack Applegame wrote: I think it should compile. ``` struct NonCopyable {     int a;     this(this) @disable; } void main() {     NonCopyable[] arr = [NonCopyable(1), NonCopyable(2)]; // ok     arr ~= NonCopyable(3); // fails } ``` This is a bug, please file. What is li

Arrays and non-copyable elements

2020-06-07 Thread Jack Applegame via Digitalmars-d-learn
I think it should compile. ``` struct NonCopyable { int a; this(this) @disable; } void main() { NonCopyable[] arr = [NonCopyable(1), NonCopyable(2)]; // ok arr ~= NonCopyable(3); // fails } ```