@ But the question is whether he want to set the array to empty or if he wants to clear the array's contents without changing the size. The second is right but it was not the point. "Clear" is just one example of several methods I want to encalupsate into TBuffer. I decided use the type helper now. Another solution is class: TBuffer = class Data: array of Single; procedure Create(ASize: Integer); procedure Clear; end; So I would call aBuffer.Data[3]:=5; instead of aBuffer[3]:=5;. Thanks ______________________________________________________________
Od: Sven Barth <pascaldra...@googlemail.com> Komu: FPC-Pascal users discussions <fpc-pascal@lists.freepascal.org> Datum: 10.06.2016 08:03 Předmět: Re: [fpc-pascal] Type helper for array
Am 10.06.2016 07:36 schrieb "Jürgen Hestermann" <juergen.hesterm...@gmx.de <juergen.hesterm...@gmx.de>>: > > Am 2016-06-09 um 20:18 schrieb Sven Barth: > > > Am 09.06.2016 17:57 schrieb "Vojtech Cihák" <vojtech.ci...@atlas.cz <vojtech.ci...@atlas.cz>>: > > > aBuffer.Clear; > > > Is it possible to do this without helper? > > > > You can always set the array to Nil > > IMO SetLength(aBuffer,0) would the most natural way to clear the array. *shrugs* That's also a way. Bit the question is whether he want to set the array to empty or if he wants to clear the array's contents without changing the size. Regards, Sven ---------- _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal <http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal>
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal