Copy Constructor

Salih Dincer salihdb at hotmail.com
Sun Jun 5 18:50:13 UTC 2022


On Sunday, 5 June 2022 at 15:45:17 UTC, Salih Dincer wrote:
> Hi,
>
> Let be the structure Foo that wraps an int pointer. Let's setup 
> Foo in 3 different ways:
>> 1. Foo one = Foo(1);
>> 2. Foo two = 2;
>> 3. [ Foo(3) ];

There is a fourth possibility:
```d
int[] arr = [ one, two, Foo(3), *(new Foo(4)) ];
```
The 1st, 2nd and 4th elements of array are copied, but the 3rd 
element is not. Could it have something to do with CTFE?
https://tour.dlang.org/tour/en/gems/compile-time-function-evaluation-ctfe

SDB at 79


More information about the Digitalmars-d-learn mailing list