@@ -206,6 +206,16 @@ module stdlib_string_type
206
206
module procedure :: verify_char_string
207
207
end interface verify
208
208
209
+ !> Version: experimental
210
+ !>
211
+ !> Moves the allocated character scalar from 'from' to 'to'
212
+ !> [Specifications](../page/specs/stdlib_string_type.html#move)
213
+ interface move
214
+ module procedure :: move_string_string
215
+ module procedure :: move_string_char
216
+ module procedure :: move_char_string
217
+ end interface move
218
+
209
219
!> Lexically compare the order of two character sequences being greater,
210
220
!> The left-hand side, the right-hand side or both character sequences can
211
221
!> be represented by a string.
@@ -721,6 +731,35 @@ contains
721
731
722
732
end function verify_char_string
723
733
734
+ !> Moves the allocated character scalar from 'from' to 'to'
735
+ !> No output
736
+ subroutine move_string_string(from, to)
737
+ type(string_type), intent(inout) :: from
738
+ type(string_type), intent(out) :: to
739
+
740
+ call move_alloc(from%raw, to%raw)
741
+
742
+ end subroutine move_string_string
743
+
744
+ !> Moves the allocated character scalar from 'from' to 'to'
745
+ !> No output
746
+ subroutine move_string_char(from, to)
747
+ type(string_type), intent(inout) :: from
748
+ character(len=:), intent(out), allocatable :: to
749
+
750
+ call move_alloc(from%raw, to)
751
+
752
+ end subroutine move_string_char
753
+
754
+ !> Moves the allocated character scalar from 'from' to 'to'
755
+ !> No output
756
+ subroutine move_char_string(from, to)
757
+ character(len=:), intent(inout), allocatable :: from
758
+ type(string_type), intent(out) :: to
759
+
760
+ call move_alloc(from, to%raw)
761
+
762
+ end subroutine move_char_string
724
763
725
764
!> Compare two character sequences for being greater.
726
765
!> In this version both character sequences are by a string.
0 commit comments