Re: Duplicate heap variables recursively [message #51367] |
Thu, 16 November 2006 04:13 |
Wox
Messages: 184 Registered: August 2006
|
Senior Member |
|
|
On 16 Nov 2006 03:30:06 -0800, tianyf@gmail.com wrote:
> You can duplicate one exact variable by using REPLICATE.
Yes, but this duplicates pointers too and that is not what I want.
IDL> print,*(*a).p
5
IDL> *(*b).p = 10
IDL> print,*(*a).p
10
-> this must stay 5, not 10.
|
|
|
Re: Duplicate heap variables recursively [message #51368 is a reply to message #51367] |
Thu, 16 November 2006 03:30  |
enod
Messages: 41 Registered: November 2004
|
Member |
|
|
You can duplicate one exact variable by using REPLICATE.
Tian
Wox wrote:
> Hello,
>
> Is there and easy way of duplicating heap variables recursively (like
> HEAP_FREE does for freeing heap variables).
>
> Something like this (but then with more complicated referencing)
> a=ptr_new({p:ptr_new(5)})
> b=duplicate(a)
> *(*b).p=10
>
> So that *(*a).p == 5 and *(*b).p == 10
|
|
|