Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
13
Task/Deepcopy/AutoHotkey/deepcopy.ahk
Normal file
13
Task/Deepcopy/AutoHotkey/deepcopy.ahk
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
DeepCopy(Array, Objs=0)
|
||||
{
|
||||
If !Objs
|
||||
Objs := Object()
|
||||
Obj := Array.Clone() ; produces a shallow copy in that any sub-objects are not cloned
|
||||
Objs[&Array] := Obj ; Save this new array - & returns the address of Array in memory
|
||||
For Key, Val in Obj
|
||||
If (IsObject(Val)) ; If it is a subarray
|
||||
Obj[Key] := Objs[&Val] ; If we already know of a reference to this array
|
||||
? Objs[&Val] ; Then point it to the new array (to prevent infinite recursion on self-references
|
||||
: DeepCopy(Val,Objs) ; Otherwise, clone this sub-array
|
||||
Return Obj
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue