On 18 Oct 2011, at 21:55, Sven Barth wrote:

> 
> type
>  TGenArray<T> = array of T; // this should work in trunk already
> 
> function Concat<T>(Arr1, Arr2: TGenArray<T>): TGenArray<T>;
> begin
>  SetLength(Result, Length(aArray1) + Length(aArray2));
>  if Length(aArray1) > 0 then
>    Move(aArray1[0], Result[0], Length(aArray1) * SizeOf(T));
>  if Length(aArray2) > 0 then
>    Move(aArray2[0], Result[Length(aArray1)], Length(aArray2) * SizeOf(T));
> end;

This implementation will result in crashes if T is a reference-counted type.


Jonas


_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to