hallo,
ich arbeite sehr viel mit dynamischen arrays in letzter zeit. Das einzige was mich stört, ist das kopieren - ich mach das zur zeit so (a1 nach a2 kopieren):
Quelltext
1: 2: 3: 4: 5: 6:
| var i:integer; a1,a2:array of integer; begin setlength(a2,length(a1)); for i:=0 to high(a1) do a2[i]:=a1[i]; end; |
da mir das immer ein bißchen viel ist wollt ich mir ne funktion zum array kopieren schreiben die den code oben ausführt. Also im prinzip so :
Quelltext
1:
| function copyarray(a1:array of integer):array of integer; |
funktioniert aber leider nicht. eine funktion kann anscheinend kein dyn. array zurückgeben.
hat jemand vielleicht eine idee, wie man das mit dem kopieren trotzdem bißchen einfacher machen kann ? Gibts schon eine mitgelieferte funktion, die das erledigt ?
mfg mk2