.dup vs operation on all elements

Goksan iamgoksan at gmail.com
Mon Dec 3 22:17:29 UTC 2018


On Monday, 3 December 2018 at 22:04:25 UTC, Neia Neutuladh wrote:
> On Mon, 03 Dec 2018 21:27:52 +0000, faissaloo wrote:
>> Then shouldn't the following output false, false, true?
>
> An object reference is a pointer value. The pointer values are 
> copied. The pointed-at objects are not copied.
>
> Furthermore, the syntax
>
>     Object[6] array = new Object();
>
> only allocates one Object. Each item in the array is an object 
> reference to the same object.

Oh great, thanks for clearing this up.

I also didn't know about shorthand only allocating one object 
(the code he shared was a piece of code we were testing with 
which I mistakenly wrote!)

Thanks!


More information about the Digitalmars-d-learn mailing list