Module ordered_pair

module ordered_pair

        ! Types
    public type pair

        ! Interfaces
    public interface reverse

        ! Subroutines and functions
    private subroutine reverse_pair (p)
    private subroutine reverse_int (i)

end module ordered_pair
Support for ordered pairs of integers. (A simple example for f90doc.)

For example, you can create the pair p = (10,20) with the following code:

     type (pair) :: p
     p%a = 10
     p%b = 20

Author: Erik Demaine

Version: simple


Description of Types

pair

public type pair
    integer :: a
The left element in the pair.
    integer :: b
The right element in the pair.
end type pair
Every pair has two parts,

Description of Interfaces

reverse

public interface reverse
    module procedure reverse_pair
    module procedure reverse_int
end interface reverse
This interface allows one to try to reverse an integer as well as a pair. Reversing the integer does nothing.

Description of Subroutines and Functions

reverse_pair

private subroutine reverse_pair (p)
    type (kind=pair), intent (inout) :: p
end subroutine reverse_pair
Reversal routine for a pair of integers. Swaps them in-place.

reverse_int

private subroutine reverse_int (i)
    integer, intent (in) :: i
end subroutine reverse_int
Reversal routine for an integer. Does nothing.