fortran vector_int, the type defined as
type::vector_int
integer,allocatable::x_(:)
integer::num_
integer::capacity_
end type vector_int
set dim
type(vector_int)::a
call a%init()
! or
!call a%init(22333)
append elements, value or array
call a%append(10)
call a%append([1,2,3,4])
return size of vector
write(*,*)size(a)
pop last element
write(*,*)a%pop()
remove all val
!! a=[1,2,3,3,4]
call a%remove(3)
!! a=[1,2,4]
delete i-th val
!! a=[1,3,2,4,9]
call a%delete(2)
!! a=[1,2,4,9]
remove duplicate elements
!! a=[1,1,3,2,2,4,4,9,10]
call a%unique()
!! a=[1,3,2,4,9,10]
sort vector
!! a=[1,1,3,2,2,4,4,9,10]
call a%sort()
!! a=[1,1,2,2,3,4,4,9,10]
cut Extra memory
! a%capacity_==a%num_
call a%cut()
deallocate
call a%clear()