traverse list from head to tail, and call the iterator function for each node.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(list), | intent(inout) | :: | me | |||
| procedure(iterator_func) | :: | iterator |
the function to call for each node. |
subroutine traverse_list(me,iterator) implicit none class(list),intent(inout) :: me procedure(iterator_func) :: iterator !! the function to call for each node. type(node),pointer :: p logical :: done done = .false. p => me%head do if (associated(p)) then call iterator(p,done) if (done) exit p => p%next else exit ! done end if end do end subroutine traverse_list