Check if target pointer exists in single-array map
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(array_ptr), | allocatable | :: | map(:) | |||
| type(array_type), | intent(in), | target | :: | target |
function map_find(map, target) result(idx) !! Check if target pointer exists in single-array map implicit none type(array_ptr), allocatable :: map(:) type(array_type), intent(in), target :: target integer :: idx, n, i idx = 0 if(.not. allocated(map)) return n = size(map) do i = 1, n if(associated(map(i)%p, target))then idx = i return end if end do end function map_find