On 7/29/16 3:00 PM, Q. Schroll wrote:
Cases to consider: Arrays and AAs with const(T) Elements, where T is a
value or a reference type respectively.

[snip]
Questions:
(1) Why do I have to specify the type here? Why does inference fail?
(2) Why not just S[S]?
The copy of a const S is a S so why is the copy of a (const S, const
S)-pair not just (S, S)?


array.dup has the meaning to copy the original but make the elements mutable. At least, that's what it was when it was handled by the compiler/runtime.

So the reason for 1 is that you can't convert const(C) to just C without a cast, so you must specify the type.

I'm not certain about AA, as I don't remember how dup was defined on them.

-Steve

Reply via email to