fdoc

subroutinecopy_valueelementalrecursiveprivate

elemental recursive subroutine copy_value(to, from)

Copy a value, with what it holds.

Arguments

NameTypeIntentAttributesDescription
toclass(value_t)inout

the copy

fromtype(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

Graphs

Called by