Open
Description
A very common request is to allow templates for subroutines or functions, in order to allow code like the following:
<T> function f(x)
<T>, intent(in) :: x
f = x + 1
end function
instead of
interface f
module procedure f_int
module procedure f_single
module procedure f_double
end interface
contains
integer function f_int(x) result(f)
integer, intent(in) :: x
f = x + 1
end function
real function f_single(x) result(f)
real, intent(in) :: x
f = x + 1
end function
real(dp) function f_double(x) result(f)
real(dp), intent(in) :: x
f = x + 1
end function
More use cases available at https://github.com/certik/fortran-generics.