assignment(=) Interface

public interface assignment(=)

Module Procedures

private subroutine ints_empty_(x, emp)

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

John S. Urban

LICENSE

MIT

Arguments

Type IntentOptional Attributes Name
integer, intent(inout), allocatable :: x(:)
type(Empty_t), intent(in) :: emp

private subroutine reals_empty_(x, emp)

Arguments

Type IntentOptional Attributes Name
real, intent(inout), allocatable :: x(:)
type(Empty_t), intent(in) :: emp

private subroutine doubles_empty_(x, emp)

Arguments

Type IntentOptional Attributes Name
doubleprecision, intent(inout), allocatable :: x(:)
type(Empty_t), intent(in) :: emp

private subroutine strings_empty_(x, emp)

Arguments

Type IntentOptional Attributes Name
character(len=:), intent(inout), allocatable :: x(:)
type(Empty_t), intent(in) :: emp