Link to home
Start Free TrialLog in
Avatar of volavy
volavy

asked on

Move contents from a pointer to another

How do I move all pointers from one TList to another?
I have a Tlist full of objects, and now I want to destroy that Tlist, after I saved the information in another (eg TList2). How do I do that?

The following code also frees Tlist2, which isn’t desirable…

TList2 := Tlist1
Tlist1.Free

/Peter
ASKER CERTIFIED SOLUTION
Avatar of kretzschmar
kretzschmar
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Madshi
Madshi

Well, I didn't try, but can't you use this:

  list2:=TList.Create;
  list2.Assign(list1);

?

Regards, Madshi.
hi madshi,

tlist has no assign-method.
this was the first i've searched for.

meikl ;-)
Avatar of volavy

ASKER

It is strange that there isn’t another solution. But it will do :)

Regards
/Peter