Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor update pure/elemental in string_type module #562

Merged
merged 2 commits into from
Nov 13, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions doc/specs/stdlib_string_type.md
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ Return the character sequence represented by the string.

#### Class

Pure function.
Elemental function.

#### Argument

Expand Down Expand Up @@ -618,7 +618,7 @@ Return a substring from the character sequence of the string.

#### Class

Pure function.
Elemental function.

#### Argument

Expand Down Expand Up @@ -1993,7 +1993,7 @@ An unallocated `string_type` instance is equivalent to an empty string.

#### Class

Pure Subroutine.
Pure subroutine (Elemental subroutine, only when both `from` and `to` are `type(string_type)`)

#### Argument

Expand Down
20 changes: 10 additions & 10 deletions src/stdlib_string_type.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,18 @@ module stdlib_string_type

!> Constructor for new string instances
interface string_type
pure elemental module function new_string(string) result(new)
elemental module function new_string(string) result(new)
character(len=*), intent(in), optional :: string
type(string_type) :: new
end function new_string
#:for kind in INT_KINDS
pure elemental module function new_string_from_integer_${kind}$(val) result(new)
elemental module function new_string_from_integer_${kind}$(val) result(new)
integer(${kind}$), intent(in) :: val
type(string_type) :: new
end function new_string_from_integer_${kind}$
#:endfor
#:for kind in LOG_KINDS
pure elemental module function new_string_from_logical_${kind}$(val) result(new)
elemental module function new_string_from_logical_${kind}$(val) result(new)
logical(${kind}$), intent(in) :: val
type(string_type) :: new
end function new_string_from_logical_${kind}$
Expand Down Expand Up @@ -438,7 +438,7 @@ contains


!> Return the character sequence represented by the string.
pure function char_string(string) result(character_string)
elemental function char_string(string) result(character_string)
type(string_type), intent(in) :: string
character(len=len(string)) :: character_string

Expand All @@ -457,7 +457,7 @@ contains
end function char_string_pos

!> Return the character sequence represented by the string.
pure function char_string_range(string, start, last) result(character_string)
elemental function char_string_range(string, start, last) result(character_string)
type(string_type), intent(in) :: string
integer, intent(in) :: start
integer, intent(in) :: last
Expand Down Expand Up @@ -678,7 +678,7 @@ contains

!> Moves the allocated character scalar from 'from' to 'to'
!> No output
subroutine move_string_string(from, to)
elemental subroutine move_string_string(from, to)
type(string_type), intent(inout) :: from
type(string_type), intent(out) :: to

Expand All @@ -688,7 +688,7 @@ contains

!> Moves the allocated character scalar from 'from' to 'to'
!> No output
subroutine move_string_char(from, to)
pure subroutine move_string_char(from, to)
type(string_type), intent(inout) :: from
character(len=:), intent(out), allocatable :: to

Expand All @@ -698,7 +698,7 @@ contains

!> Moves the allocated character scalar from 'from' to 'to'
!> No output
subroutine move_char_string(from, to)
pure subroutine move_char_string(from, to)
character(len=:), intent(inout), allocatable :: from
type(string_type), intent(out) :: to

Expand All @@ -708,7 +708,7 @@ contains

!> Moves the allocated character scalar from 'from' to 'to'
!> No output
subroutine move_char_char(from, to)
pure subroutine move_char_char(from, to)
character(len=:), intent(inout), allocatable :: from
character(len=:), intent(out), allocatable :: to

Expand Down Expand Up @@ -1233,7 +1233,7 @@ contains


!> Safely return the character sequences represented by the string
pure function maybe(string) result(maybe_string)
elemental function maybe(string) result(maybe_string)
type(string_type), intent(in) :: string
character(len=len(string)) :: maybe_string
if (allocated(string%raw)) then
Expand Down