Provides a generic function optval
, which can be used to
conveniently implement fallback values for optional arguments
to subprograms
(Specification)
If x
is an optional
parameter of a
subprogram, then the expression optval(x, default)
inside that
subprogram evaluates to x
if it is present, otherwise default
.
It is an error to call optval
with a single actual argument.
Interfaces
Fallback value for optional arguments
(Specification)
-
private pure elemental function optval_rsp(x, default) result(y)
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
real(kind=sp),
|
intent(in), |
optional |
|
:: |
x |
|
real(kind=sp),
|
intent(in) |
|
|
:: |
default |
|
Return Value
real(kind=sp)
-
private pure elemental function optval_rdp(x, default) result(y)
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
real(kind=dp),
|
intent(in), |
optional |
|
:: |
x |
|
real(kind=dp),
|
intent(in) |
|
|
:: |
default |
|
Return Value
real(kind=dp)
-
private pure elemental function optval_iint8(x, default) result(y)
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
integer(kind=int8),
|
intent(in), |
optional |
|
:: |
x |
|
integer(kind=int8),
|
intent(in) |
|
|
:: |
default |
|
Return Value
integer(kind=int8)
-
private pure elemental function optval_iint16(x, default) result(y)
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
integer(kind=int16),
|
intent(in), |
optional |
|
:: |
x |
|
integer(kind=int16),
|
intent(in) |
|
|
:: |
default |
|
Return Value
integer(kind=int16)
-
private pure elemental function optval_iint32(x, default) result(y)
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
integer(kind=int32),
|
intent(in), |
optional |
|
:: |
x |
|
integer(kind=int32),
|
intent(in) |
|
|
:: |
default |
|
Return Value
integer(kind=int32)
-
private pure elemental function optval_iint64(x, default) result(y)
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
integer(kind=int64),
|
intent(in), |
optional |
|
:: |
x |
|
integer(kind=int64),
|
intent(in) |
|
|
:: |
default |
|
Return Value
integer(kind=int64)
-
private pure elemental function optval_csp(x, default) result(y)
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
complex(kind=sp),
|
intent(in), |
optional |
|
:: |
x |
|
complex(kind=sp),
|
intent(in) |
|
|
:: |
default |
|
Return Value
complex(kind=sp)
-
private pure elemental function optval_cdp(x, default) result(y)
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
complex(kind=dp),
|
intent(in), |
optional |
|
:: |
x |
|
complex(kind=dp),
|
intent(in) |
|
|
:: |
default |
|
Return Value
complex(kind=dp)
-
private pure elemental function optval_ll1(x, default) result(y)
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
logical,
|
intent(in), |
optional |
|
:: |
x |
|
logical,
|
intent(in) |
|
|
:: |
default |
|
Return Value
logical
-
private pure function optval_character(x, default) result(y)
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
character(len=*),
|
intent(in), |
optional |
|
:: |
x |
|
character(len=*),
|
intent(in) |
|
|
:: |
default |
|
Return Value
character(len=:), allocatable