Copy of the live elements as a plain array of extent size(),
not capacity(). Returns a zero-length array when empty. This is
how the contents are handed to ordinary Fortran routines; note
that it is the one operation here that does allocate, so keep it
out of the hot path.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(fixed_array_dp_t), | intent(in) | :: | self |
pure function fixed_array_dp_as_array(self) result(arr) !! Copy of the live elements as a plain array of extent `size()`, !! not `capacity()`. Returns a zero-length array when empty. This is !! how the contents are handed to ordinary Fortran routines; note !! that it is the one operation here that does allocate, so keep it !! out of the hot path. class(fixed_array_dp_t), intent(in) :: self real(dp), allocatable :: arr(:) allocate (arr(self%n_items)) arr(1:self%n_items) = self%items(1:self%n_items) end function fixed_array_dp_as_array