template authoring 配列容量を確保する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(app_config_authoring), | intent(inout) | :: | authoring | |||
| integer, | intent(in) | :: | required_size |
subroutine ensure_authoring_template_capacity(authoring, required_size) type(app_config_authoring), intent(inout) :: authoring integer, intent(in) :: required_size type(template_authoring_spec), allocatable :: grown(:) integer :: old_capacity, new_capacity if (required_size <= 0) return if (allocated(authoring%templates)) then old_capacity = size(authoring%templates) else old_capacity = 0 end if if (old_capacity >= required_size) return new_capacity = max(required_size, max(1, 2*old_capacity)) allocate (grown(new_capacity)) grown = template_authoring_spec() if (old_capacity > 0) grown(1:old_capacity) = authoring%templates(1:old_capacity) call move_alloc(grown, authoring%templates) end subroutine ensure_authoring_template_capacity