Skip to content

Commit 0c0f002

Browse files
committed
completed TODO by adding move subroutine
1 parent ef8248b commit 0c0f002

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/stdlib_stringlist_type.f90

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
! throughout the PR
1616
!
1717
module stdlib_stringlist_type
18-
use stdlib_string_type, only: string_type, operator(/=)
18+
use stdlib_string_type, only: string_type, operator(/=), move
1919
use stdlib_math, only: clip
2020
implicit none
2121
private
@@ -600,13 +600,11 @@ subroutine insert_before_empty_positions( list, idxn, positions )
600600
allocate( new_stringarray(new_len) )
601601

602602
do i = 1, idxn - 1
603-
! TODO: can be improved by move
604-
new_stringarray(i) = list%stringarray(i)
603+
call move( list%stringarray(i), new_stringarray(i) )
605604
end do
606605
do i = idxn, old_len
607606
inew = i + positions
608-
! TODO: can be improved by move
609-
new_stringarray(inew) = list%stringarray(i)
607+
call move( list%stringarray(i), new_stringarray(inew) )
610608
end do
611609

612610
call move_alloc( new_stringarray, list%stringarray )
@@ -762,13 +760,11 @@ impure function delete_string_idx_impl( list, idx )
762760
allocate( new_stringarray(new_len) )
763761

764762
do i = 1, idxn - 1
765-
! TODO: can be improved by move
766-
new_stringarray(i) = list%stringarray(i)
763+
call move( list%stringarray(i), new_stringarray(i) )
767764
end do
768765
do i = idxn + 1, old_len
769766
inew = i - 1
770-
! TODO: can be improved by move
771-
new_stringarray(inew) = list%stringarray(i)
767+
call move( list%stringarray(i), new_stringarray(inew) )
772768
end do
773769

774770
call move_alloc( new_stringarray, list%stringarray )

0 commit comments

Comments
 (0)