We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 450ec76 commit 2ed9fcdCopy full SHA for 2ed9fcd
src/stdlib_string_type.f90
@@ -686,12 +686,13 @@ end function verify_char_string
686
!> Moves the allocated character scalar from 'from' to 'to'
687
!> No output
688
elemental subroutine move_string_string(from, to)
689
- type(string_type), intent(inout) :: from
690
- type(string_type), intent(inout) :: to
691
- character(:), allocatable :: tmp
+ type(string_type), intent(inout), target :: from
+ type(string_type), intent(inout), target :: to
+ type(string_type), pointer :: fromp
692
693
- call move_alloc(from%raw, tmp)
694
- call move_alloc(tmp, to%raw)
+ fromp => from
+ if (associated(fromp,to)) return
695
+ call move_alloc(from%raw, to%raw)
696
697
end subroutine move_string_string
698
0 commit comments