Pop
Remove an entry from a vector at a specific location.
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE PURE FUNCTION Pop(vec, pos) RESULT(ans)
INTEGER(Int8|Int16|In32|Int64|Real32|Real64), INTENT(IN) :: vec(:)
INTEGER(I4B), INTENT(IN) :: pos
INTEGER(Int8|Int16|In32|Int64|Real32|Real64) :: ans(MAX(SIZE(vec) - 1, 0))
END FUNCTION Pop
END INTERFACE
PROGRAM main
use easifemBase
integer(i4b), allocatable :: indx(:), ans(:)
indx = [1,2,3,4,5]
ans = Pop(indx, 1)
call Display( ans, "ans= " )
results
ans=
2 3 4 5
ans = Pop(indx, 5)
call Display( ans, "ans= " )
results
ans=
1 2 3 4
ans = Pop(indx, 2)
call Display( ans, "ans= " )
results
ans=
1 3 4 5
END PROGRAM main