NAME
empty(3f) - [M_anything] set an allocatable array to zero
(LICENSE:MIT)
SYNOPSIS
use M_anything, only : empty, assignment(=)
DESCRIPTION
A convenience routine that sets an array to an empty set.
EXAMPLE
Sample program:
program demo_empty_
use M_anything, only : empty, assignment(=)
integer, allocatable :: ints(:)
character(:), allocatable :: strs(:)
real, allocatable :: reals(:)
ints=empty
write(*,*)size(ints)
write(*,*)'give them some size ...'
reals = [1.0,2.0,3.0]
ints = [1,2,3]
strs = [character(len=10) :: "one","two","three","four"]
write(*,*)size(ints)
write(*,*)size(reals)
write(*,*)size(strs)
ints=empty
reals=empty
strs=empty
write(*,*)'back to empty ...'
write(*,*)size(ints)
write(*,*)size(reals)
write(*,*)size(strs)
end program demo_empty_
Expected output:
> 0
> give them some size ...
> 3
> 3
> 4
> back to empty ...
> 0
> 0
> 0
AUTHOR
LICENSE
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
integer,
|
intent(inout), |
|
allocatable
|
:: |
x(:) |
|
type(Empty_t),
|
intent(in) |
|
|
:: |
emp |
|