Closed
@zoziha

Description

Description

Does stdlib need simple swap routines as follows? (Wait for #449 )

interface swap
    ...
end interface swap

!! Swap the values of two variables of the same type.
!! `type & kind` description: logical, integer, real, complex, character, string_type
pure elemental subroutine swap_${t1[0]}$${k1}$(a, b)
	${t1}$, intent(inout) :: a, b
	${t1}$ :: c
	c = a
	a = b
	b = c
end subroutine swap_${t1[0]}$${k1}$

call [[stdlib_math(module):swap(interface)]](a, b)

The use of swap already in stdlib:

  1. Initial implementation of COO / CSR sparse format #189 (comment)
  2. https://.com/fortran-lang/stdlib/blob/888b5d343e5579a392273755b66394404fd361f9/src/stdlib_sorting_sort.fypp#L216~L219