Skip to content

Commit df9edbd

Browse files
committed
Fix pure/elemental in string_type
1 parent f58da3b commit df9edbd

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

doc/specs/stdlib_string_type.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ Return the character sequence represented by the string.
528528

529529
#### Class
530530

531-
Pure function.
531+
Elemental function.
532532

533533
#### Argument
534534

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

619619
#### Class
620620

621-
Pure function.
621+
Elemental function.
622622

623623
#### Argument
624624

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

19941994
#### Class
19951995

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

19981998
#### Argument
19991999

src/stdlib_string_type.fypp

+10-10
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,18 @@ module stdlib_string_type
5252

5353
!> Constructor for new string instances
5454
interface string_type
55-
pure elemental module function new_string(string) result(new)
55+
elemental module function new_string(string) result(new)
5656
character(len=*), intent(in), optional :: string
5757
type(string_type) :: new
5858
end function new_string
5959
#:for kind in INT_KINDS
60-
pure elemental module function new_string_from_integer_${kind}$(val) result(new)
60+
elemental module function new_string_from_integer_${kind}$(val) result(new)
6161
integer(${kind}$), intent(in) :: val
6262
type(string_type) :: new
6363
end function new_string_from_integer_${kind}$
6464
#:endfor
6565
#:for kind in LOG_KINDS
66-
pure elemental module function new_string_from_logical_${kind}$(val) result(new)
66+
elemental module function new_string_from_logical_${kind}$(val) result(new)
6767
logical(${kind}$), intent(in) :: val
6868
type(string_type) :: new
6969
end function new_string_from_logical_${kind}$
@@ -438,7 +438,7 @@ contains
438438

439439

440440
!> Return the character sequence represented by the string.
441-
pure function char_string(string) result(character_string)
441+
elemental function char_string(string) result(character_string)
442442
type(string_type), intent(in) :: string
443443
character(len=len(string)) :: character_string
444444

@@ -457,7 +457,7 @@ contains
457457
end function char_string_pos
458458

459459
!> Return the character sequence represented by the string.
460-
pure function char_string_range(string, start, last) result(character_string)
460+
elemental function char_string_range(string, start, last) result(character_string)
461461
type(string_type), intent(in) :: string
462462
integer, intent(in) :: start
463463
integer, intent(in) :: last
@@ -678,7 +678,7 @@ contains
678678

679679
!> Moves the allocated character scalar from 'from' to 'to'
680680
!> No output
681-
subroutine move_string_string(from, to)
681+
elemental subroutine move_string_string(from, to)
682682
type(string_type), intent(inout) :: from
683683
type(string_type), intent(out) :: to
684684

@@ -688,7 +688,7 @@ contains
688688

689689
!> Moves the allocated character scalar from 'from' to 'to'
690690
!> No output
691-
subroutine move_string_char(from, to)
691+
pure subroutine move_string_char(from, to)
692692
type(string_type), intent(inout) :: from
693693
character(len=:), intent(out), allocatable :: to
694694

@@ -698,7 +698,7 @@ contains
698698

699699
!> Moves the allocated character scalar from 'from' to 'to'
700700
!> No output
701-
subroutine move_char_string(from, to)
701+
pure subroutine move_char_string(from, to)
702702
character(len=:), intent(inout), allocatable :: from
703703
type(string_type), intent(out) :: to
704704

@@ -708,7 +708,7 @@ contains
708708

709709
!> Moves the allocated character scalar from 'from' to 'to'
710710
!> No output
711-
subroutine move_char_char(from, to)
711+
pure subroutine move_char_char(from, to)
712712
character(len=:), intent(inout), allocatable :: from
713713
character(len=:), intent(out), allocatable :: to
714714

@@ -1233,7 +1233,7 @@ contains
12331233

12341234

12351235
!> Safely return the character sequences represented by the string
1236-
pure function maybe(string) result(maybe_string)
1236+
elemental function maybe(string) result(maybe_string)
12371237
type(string_type), intent(in) :: string
12381238
character(len=len(string)) :: maybe_string
12391239
if (allocated(string%raw)) then

0 commit comments

Comments
 (0)