- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I was wondering about something: does anyone know of a slick way to make a copy of a linked list so that the pointers in the new list don't point back to the original list? Basically, to clone it so that the two are complete independent, but contain the same data. allocate(new,source=old) doesn't work because the new pointers point the same locations as the old ones. I suspect such a thing isn't possible, without manually traversing the structure, but was wondering if anyone had any ideas. I think the Fortran 2008 "Allocatable components of recursive type" feature might make something like this easier?
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No, that would not make it easier. You have to traverse the list. You really can't use allocatables for list links.
![](/skins/images/06022F5BB6D2F28C8F102671A0F06E85/responsive_peak/images/icon_anonymous_message.png)
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page