type, public :: item
An item to be sorted or searched.
User has to define the operator and assignment functions.
Type-Bound Procedures
-
function greater_than_func(v1, v2) result(gt)
Prototype
Arguments
| Type |
Intent | Optional | Attributes |
|
Name |
|
|
class(item),
|
intent(in) |
|
|
:: |
v1 |
|
|
class(item),
|
intent(in) |
|
|
:: |
v2 |
|
Return Value
logical
-
function less_than_func(v1, v2) result(lt)
Prototype
Arguments
| Type |
Intent | Optional | Attributes |
|
Name |
|
|
class(item),
|
intent(in) |
|
|
:: |
v1 |
|
|
class(item),
|
intent(in) |
|
|
:: |
v2 |
|
Return Value
logical
-
function equal_to_func(v1, v2) result(eq)
Prototype
Arguments
| Type |
Intent | Optional | Attributes |
|
Name |
|
|
class(item),
|
intent(in) |
|
|
:: |
v1 |
|
|
class(item),
|
intent(in) |
|
|
:: |
v2 |
|
Return Value
logical
-
subroutine assign_equal_func(v1, v2)
Prototype
Arguments
| Type |
Intent | Optional | Attributes |
|
Name |
|
|
class(item),
|
intent(out) |
|
|
:: |
v1 |
|
|
class(item),
|
intent(in) |
|
|
:: |
v2 |
|
-
function greater_than_func(v1, v2) result(gt)
Prototype
Arguments
| Type |
Intent | Optional | Attributes |
|
Name |
|
|
class(item),
|
intent(in) |
|
|
:: |
v1 |
|
|
class(item),
|
intent(in) |
|
|
:: |
v2 |
|
Return Value
logical
-
function less_than_func(v1, v2) result(lt)
Prototype
Arguments
| Type |
Intent | Optional | Attributes |
|
Name |
|
|
class(item),
|
intent(in) |
|
|
:: |
v1 |
|
|
class(item),
|
intent(in) |
|
|
:: |
v2 |
|
Return Value
logical
-
function equal_to_func(v1, v2) result(eq)
Prototype
Arguments
| Type |
Intent | Optional | Attributes |
|
Name |
|
|
class(item),
|
intent(in) |
|
|
:: |
v1 |
|
|
class(item),
|
intent(in) |
|
|
:: |
v2 |
|
Return Value
logical
-
subroutine assign_equal_func(v1, v2)
Prototype
Arguments
| Type |
Intent | Optional | 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