<div dir="auto"><div>Yes it is. The dup version just make an extra copy of array for no reason. </div><div dir="auto"><br></div><div dir="auto"><br><br><div class="gmail_quote" dir="auto"><div dir="ltr">po 3. 12. 2018 21:10 odesílatel Goksan via Digitalmars-d-learn <<a href="mailto:digitalmars-d-learn@puremagic.com">digitalmars-d-learn@puremagic.com</a>> napsal:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Are there any differences between these 2 methods of copying <br>
elements?<br>
<br>
double[] array = [ 1, 20, 2, 30, 7, 11 ];<br>
<br>
// Non dup<br>
double[6] bracket_syntax_dup = array;<br>
bracket_syntax_dup[] = array;<br>
bracket_syntax_dup[0] = 50;<br>
<br>
// Dup<br>
double[6] normal_dup = array.dup;<br>
normal_dup[0] = 100;<br>
<br>
OUTPUT: (array, bracket_syntax_dup and normal_dup respectively):<br>
[1, 20, 2, 30, 7, 11]<br>
[50, 20, 2, 30, 7, 11]<br>
[100, 20, 2, 30, 7, 11]<br>
</blockquote></div></div></div>