Yes it is. The dup version just make an extra copy of array for no reason.
po 3. 12. 2018 21:10 odesÃlatel Goksan via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> napsal: > Are there any differences between these 2 methods of copying > elements? > > double[] array = [ 1, 20, 2, 30, 7, 11 ]; > > // Non dup > double[6] bracket_syntax_dup = array; > bracket_syntax_dup[] = array; > bracket_syntax_dup[0] = 50; > > // Dup > double[6] normal_dup = array.dup; > normal_dup[0] = 100; > > OUTPUT: (array, bracket_syntax_dup and normal_dup respectively): > [1, 20, 2, 30, 7, 11] > [50, 20, 2, 30, 7, 11] > [100, 20, 2, 30, 7, 11] >