move_alloc(3f) - [FORTRAN:INTRINSIC] Move allocation from one object to another
Syntax
Description
Arguments
Example
Standard
Class
See Also
call move_alloc(src, dest)
move_alloc(src, dest) moves the allocation from SRC to DEST. SRC will become deallocated in the process.
SRC - ALLOCATABLE, intent(inout), may be of any type and kind. DEST - ALLOCATABLE, intent(out), shall be of the same type, kind and rank as SRC.
Sample program:
program demo_move_alloc integer, allocatable :: a(:), b(:)allocate(a(3)) a = [ 1, 2, 3 ] call move_alloc(a, b) print *, allocated(a), allocated(b) print *, b end program demo_move_alloc
[[Fortran 2003]] and later
Pure subroutine
[[allocated]]
move_alloc (3) | March 18, 2019 |