Skip to content

Commit e446e7a

Browse files
committed
completed TODO by adding move subroutine
1 parent c790494 commit e446e7a

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 )
@@ -766,13 +764,11 @@ impure function delete_string_idx_impl( list, idx )
766764
allocate( new_stringarray(new_len) )
767765

768766
do i = 1, idxn - 1
769-
! TODO: can be improved by move
770-
new_stringarray(i) = list%stringarray(i)
767+
call move( list%stringarray(i), new_stringarray(i) )
771768
end do
772769
do i = idxn + 1, old_len
773770
inew = i - 1
774-
! TODO: can be improved by move
775-
new_stringarray(inew) = list%stringarray(i)
771+
call move( list%stringarray(i), new_stringarray(inew) )
776772
end do
777773

778774
call move_alloc( new_stringarray, list%stringarray )

0 commit comments

Comments
 (0)