On 28.07.2016 21:45, Ali Çehreli wrote:
On 07/27/2016 04:51 AM, drug wrote:
> cfoo.copy(foo); // fails to compile because phobos in case of array uses
> // array specialization and this specialization fails
> // see
>
https://github.com/dlang/phobos/blob/v2.07
On 07/27/2016 04:51 AM, drug wrote:
> cfoo.copy(foo); // fails to compile because phobos in case of array uses
> // array specialization and this specialization fails
> // see
>
https://github.com/dlang/phobos/blob/v2.071.1/std/algorithm/mutation.d#L333
Thanks f
I see. I'll try to rephrase my question to be clear. We have:
```
struct Foo
{
int i;
float f;
}
int main()
{
const(Foo)[] cfoo = [Foo(1, 0.5), Foo(2, 0.75)];
Foo[] foo;
cfoo.copy(foo); // it works, constness no matter here because Foo is
value type
}
```
but i
On 07/27/2016 04:51 AM, drug wrote:
> I have the following:
>
> ```
> struct Foo
> {
> int[] i;
>
> this(int[] i)
> {
> this.i = i.dup;
> }
>
> ref Foo opAssign(ref const(this) other)
> {
> i = other.i.dup;
>
> return this;
> }
> }
You're defini