item Derived Type

type, public :: item

An item to be sorted or searched.

User has to define the operator and assignment functions.


Type-Bound Procedures

generic, public :: operator(>) => greater_than

  • function greater_than_func(v1, v2) result(gt) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(item), intent(in) :: v1
    class(item), intent(in) :: v2

    Return Value logical

generic, public :: operator(<) => less_than

  • function less_than_func(v1, v2) result(lt) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(item), intent(in) :: v1
    class(item), intent(in) :: v2

    Return Value logical

generic, public :: operator(==) => equal_to

  • function equal_to_func(v1, v2) result(eq) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(item), intent(in) :: v1
    class(item), intent(in) :: v2

    Return Value logical

generic, public :: assignment(=) => assign_equal

  • subroutine assign_equal_func(v1, v2) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(item), intent(out) :: v1
    class(item), intent(in) :: v2

procedure(greater_than_func), public, deferred :: greater_than

  • function greater_than_func(v1, v2) result(gt) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(item), intent(in) :: v1
    class(item), intent(in) :: v2

    Return Value logical

procedure(less_than_func), public, deferred :: less_than

  • function less_than_func(v1, v2) result(lt) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(item), intent(in) :: v1
    class(item), intent(in) :: v2

    Return Value logical

procedure(equal_to_func), public, deferred :: equal_to

  • function equal_to_func(v1, v2) result(eq) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(item), intent(in) :: v1
    class(item), intent(in) :: v2

    Return Value logical

procedure(assign_equal_func), public, deferred :: assign_equal

  • subroutine assign_equal_func(v1, v2) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(item), intent(out) :: v1
    class(item), intent(in) :: v2

Source Code

    type,abstract,public :: item
        !! An item to be sorted or searched.
        !!
        !! User has to define the operator and assignment functions.
    contains
        private
        generic,public :: operator(>)   => greater_than
        generic,public :: operator(<)   => less_than
        generic,public :: operator(==)  => equal_to
        generic,public :: assignment(=) => assign_equal
        procedure(greater_than_func),deferred,public :: greater_than
        procedure(less_than_func),deferred,public    :: less_than
        procedure(equal_to_func),deferred,public     :: equal_to
        procedure(assign_equal_func),deferred,public :: assign_equal
    end type item