1

Topic: Adding TRecordType in TList <TRecordType>

Standard situation.
There is a type:

TRecordType =
A, B: integer
end;

Also it is necessary to create the list, adding this data:

TRecList = TList &lt;TRecordType&gt;;
...
var rt: TRecordType; Lst: TRecList;
begin
Lst: = TRecList. Create;
for i: = 0 to 10
begin
rt.a: = i * 1;
rt.b: = i * 2;
Lst. Add (rt);
end;
end

And here I understand that it after all a jamb - each record refers to one and too a storage place. Or all the same there is a copying of new value?

2

Re: Adding TRecordType in TList <TRecordType>

_ _;
record it will be copied...

3

Re: Adding TRecordType in TList <TRecordType>

zinpub wrote:

_ _;
record it will be copied...

That is there will be no identical records?

4

Re: Adding TRecordType in TList <TRecordType>

_ _;
Identical, in sense referring in one place, will not be.

5

Re: Adding TRecordType in TList <TRecordType>

zinpub wrote:

_ _;
Identical, in sense referring in one place, will not be.

Thanks.
Checked up, indeed.
I so understand there where that is check object on an input or not and depending on it happens or storage creation under the data or link record.

6

Re: Adding TRecordType in TList <TRecordType>

_ _;
record - the controlled type, the link should be received pens...

7

Re: Adding TRecordType in TList <TRecordType>

Well and on idea leak. Who then releases storage?

8

Re: Adding TRecordType in TList <TRecordType>

krapotkin;
Does not go.
But here access through "Lst [n].A: =" to make does not quit.  entirely all record to appropriate.

9

Re: Adding TRecordType in TList <TRecordType>

type
TRecordType = record
strict private
FA: Int32;
FB: Int32;
public
constructor Create (const A, B: Int32);
property A: Int32 read FA;
property B: Int32 read FB;
end;
TRecordTypeList = TList &lt;TRecordType&gt;;
implementation
{TRecordType}
constructor TRecordType. Create (const A, B: Int32);
begin
FA: = A;
FB: = B;
end;
procedure TForm1.FormCreate (Sender: TObject);
var
List: TRecordTypeList;
i: Int32;
begin
List: = TRecordTypeList. Create ();
for i: = 0 to 10 do
//So it is more beautiful
List. Add (TRecordType. Create (i * 1, i * 2));
end;

10

Re: Adding TRecordType in TList <TRecordType>

rgreat wrote:

But here access through "Lst [n].A: =" to make does not quit.  entirely all record to appropriate.

Lst. List [n].A: =....;