Board index » delphi » dynamic arrays/sorted arrays

dynamic arrays/sorted arrays

Is it true that you cannot create dynamic arrays with Pascal/Delphi?  
Does anyone have a workaround for this?  How does one sort arrays in
Pascal?  I formerly used the Container Class Libraries as found in
Borland C++ for both of these duties.  Is there anything analogous
to container classes available to Delphi projects?
 

Re:dynamic arrays/sorted arrays


Quote
Paul Potok <ppo...@ix.netcom.com> wrote:
>Is it true that you cannot create dynamic arrays with Pascal/Delphi?  

Of course you can create dynamic arrays. See Get/FreeMem.

Quote
>Does anyone have a workaround for this?  How does one sort arrays in
>Pascal?  I formerly used the Container Class Libraries as found in
>Borland C++ for both of these duties.  Is there anything analogous
>to container classes available to Delphi projects?

I didn't see one yet. I wrote my own. Borland Pascal used to have
TCollection. Delphi seems to be using a linked list.

Re:dynamic arrays/sorted arrays


Quote
Paul Potok wrote:

> Is it true that you cannot create dynamic arrays with Pascal/Delphi?
> Does anyone have a workaround for this?  How does one sort arrays in
> Pascal?  I formerly used the Container Class Libraries as found in
> Borland C++ for both of these duties.  Is there anything analogous
> to container classes available to Delphi projects?Hi Paul

Not true. For a simple dynamic array use TList in Delphi. It's a class
that can be adressed like an array. In BP 7 use TCollection, it has a
sort method to, and for Delphi you can download my OBJECTS7 unit from
  http://sunsite.icm.edu.pl/~robert/delphi/freelib.html

it reimplements TCollection under Delphi with some extrea stuff.

Best regards

Guy Fink (By kind permission of Alain Rassel)

Re:dynamic arrays/sorted arrays


On 2 Jan 1996 21:10:44 GMT, Slobodan Celenkovic <slobo...@cs.unh.edu>
wrote:

Quote
>Paul Potok <ppo...@ix.netcom.com> wrote:
>>Does anyone have a workaround for this?  How does one sort arrays in
>>Pascal?  I formerly used the Container Class Libraries as found in
>>Borland C++ for both of these duties.  Is there anything analogous
>>to container classes available to Delphi projects?

>I didn't see one yet. I wrote my own. Borland Pascal used to have
>TCollection. Delphi seems to be using a linked list.

The TList class that Delphi uses for variable sized arrays uses an
array implementation, not a linked list implementation. It does not,
however, have any sorting built into it.

TStringList has sorting built in, if you want a list of strings.
Again, TStringList uses an array implementation, not a linked list
implementation.
--
Ray Lischner         (li...@tempest-sw.com)
Tempest Software, Corvallis, Oregon, USA

Other Threads