Materialize the accumulator into a right-sized array.
The accumulator storage is released after conversion.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(string_accum_t), | intent(inout) | :: | self | |||
| type(string_t), | intent(out), | allocatable | :: | out(:) |
subroutine accum_to_array(self, out) class(string_accum_t), intent(inout) :: self type(string_t), allocatable, intent(out) :: out(:) if (.not. allocated(self%a) .or. self%n <= 0) then allocate(out(0)) return end if allocate(out(self%n)) out = self%a(1:self%n) deallocate(self%a) self%n = 0 end subroutine accum_to_array