subroutinecopy_valueelementalrecursiveprivate
elemental recursive subroutine copy_value(to, from)
Copy a value, with what it holds.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| to | class(value_t) | inout | the copy | |
| from | type(value_t) | in | the value |
Calls
Source
Show the code
recursive elemental subroutine copy_value(to, from)
class(value_t), intent(inout) :: to !! the copy
type(value_t), intent(in) :: from !! the value
integer :: k
to%kind = from%kind
to%number = from%number
if (allocated(to%text)) deallocate (to%text)
if (allocated(to%items)) deallocate (to%items)
if (allocated(from%text)) to%text = from%text
if (allocated(from%items)) then
allocate (to%items(size(from%items)))
do k = 1, size(from%items)
call copy_value(to%items(k), from%items(k))
end do
end if
end subroutine copy_value