Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e935ea1

Browse files
improved append operator's performance
1 parent 980c18a commit e935ea1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

‎src/stdlib_stringlist_type.f90‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,8 @@ function append_char( lhs, rhs )
222222
character(len=*), intent(in) :: rhs
223223
type(stringlist_type) :: append_char
224224

225-
append_char = lhs // string_type( rhs )
225+
append_char = lhs ! Intent: creating a full, deep copy
226+
call append_char%insert_at( list_tail, rhs )
226227

227228
end function append_char
228229

@@ -245,7 +246,8 @@ function prepend_char( lhs, rhs )
245246
type(stringlist_type), intent(in) :: rhs
246247
type(stringlist_type) :: prepend_char
247248

248-
prepend_char = string_type( lhs ) // rhs
249+
prepend_char = rhs ! Intent: creating a full, deep copy
250+
call prepend_char%insert_at( list_head, lhs )
249251

250252
end function prepend_char
251253

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /