我可以用这种方式创建一个没有指针的 Fortran 链表吗:
列表:
TYPE Allocation_List
PRIVATE
CLASS(*), ALLOCATABLE :: Item
CLASS(Allocation_List), ALLOCATABLE :: Next
CONTAINS
PROCEDURE, PASS(self), PUBLIC, NON_OVERRIDABLE :: IsItem => IsItem_AllocationList
PROCEDURE, PASS(self), PUBLIC :: SetItem => SetItem_AllocationList
PROCEDURE, PASS(self), PUBLIC :: GetItem => GetItem_AllocationList
PROCEDURE, PASS(self), PUBLIC, NON_OVERRIDABLE :: FreeItem => FreeItem_AllocationList
PROCEDURE, PASS(self), PUBLIC, NON_OVERRIDABLE :: IsNext => IsNext_AllocationList
PROCEDURE, PASS(self), PUBLIC :: SetNext => SetNext_AllocationList
PROCEDURE, PASS(self), PUBLIC :: GetNext => GetNext_AllocationList
PROCEDURE, PASS(self), PUBLIC, NON_OVERRIDABLE :: FreeNext => FreeNext_AllocationList
PROCEDURE, PASS(self), PUBLIC, NON_OVERRIDABLE :: Reset => Reset_AllocationList
PROCEDURE, PASS(self), PUBLIC :: Display => Display_AllocationListItem
END TYPE Allocation_List
链表:
TYPE Allocation_LinkedList
PRIVATE
CLASS(Allocation_List), ALLOCATABLE :: HeadList
CLASS(Allocation_List), ALLOCATABLE :: CurrList
CLASS(Allocation_List), ALLOCATABLE :: TailList
CONTAINS
PROCEDURE, PASS(self), PUBLIC, NON_OVERRIDABLE :: IsSet => IsSet_AllocationLinkedList
PROCEDURE, PASS(self), PUBLIC, NON_OVERRIDABLE :: Initiate => Initiate_AllocationLinkedList
PROCEDURE, PASS(self), PUBLIC, NON_OVERRIDABLE :: Connect => Connect_AllocationLinkedList
PROCEDURE, PASS(self), PUBLIC, NON_OVERRIDABLE :: GetCurr => GetCurrent_AllocationLinkedList
PROCEDURE, PASS(self), PUBLIC, NON_OVERRIDABLE :: ForCurr => ForwardCurrent_AllocationLinkedList
PROCEDURE, PASS(self), PUBLIC, NON_OVERRIDABLE :: DispCurr => DisplayCurrent_AllocationLinkedList
PROCEDURE, PASS(self), PUBLIC, NON_OVERRIDABLE :: ResetCurr => ResetCurrent_AllocationLinkedList
PROCEDURE, PASS(self), PUBLIC, NON_OVERRIDABLE :: Reset => Reset_AllocationLinkedList
PROCEDURE, PASS(self), PUBLIC, NON_OVERRIDABLE :: Display => Display_AllocationLinkedList
END TYPE Allocation_LinkedList
这个列表在用于创建链接列表时会起作用吗?什么可能出错,有什么缺点吗?指针相对于可分配对象的优势是什么?