Remove and return the last element. ERROR_BOUNDS when empty, in
which case the vector is unchanged.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(vector_dp_t), | intent(inout) | :: | self | |||
| real(kind=dp), | intent(out) | :: | value | |||
| type(error_t), | intent(inout), | optional | :: | err |
pure subroutine vec_dp_pop_back(self, value, err) !! Remove and return the last element. `ERROR_BOUNDS` when empty, in !! which case the vector is unchanged. class(vector_dp_t), intent(inout) :: self real(dp), intent(out) :: value type(error_t), intent(inout), optional :: err if (self%n_items <= 0) then call error_raise(err, ERROR_BOUNDS, "vector_dp_t: pop_back on an empty vector.") return end if value = self%items(self%n_items) self%n_items = self%n_items - 1 end subroutine vec_dp_pop_back