Growable array of integer(int64).
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer(kind=int64), | private, | allocatable | :: | items(:) |
Backing storage. Only |
||
| integer(kind=default_int), | private | :: | n_items | = | 0 |
Number of live elements. Always |
Append many elements, growing once rather than once per element.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(vector_int64_t), | intent(inout) | :: | self | |||
| integer(kind=int64), | intent(in) | :: | values(:) | |||
| type(error_t), | intent(inout), | optional | :: | err |
A copy holding exactly size() elements.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(vector_int64_t), | intent(in) | :: | self |
Read element index, 1-based. ERROR_BOUNDS when out of range.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(vector_int64_t), | intent(in) | :: | self | |||
| integer(kind=default_int), | intent(in) | :: | index | |||
| integer(kind=int64), | intent(out) | :: | value | |||
| type(error_t), | intent(inout), | optional | :: | err |
Elements that fit before the next reallocation.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(vector_int64_t), | intent(in) | :: | self |
Drop every element but keep the allocated storage, so a vector reused across iterations of an outer loop stops reallocating.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(vector_int64_t), | intent(inout) | :: | self |
Release all storage and reset to the empty state.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(vector_int64_t), | intent(inout) | :: | self |
Element index with no bounds check, for hot loops that have already
established the range. Reading outside 1:size() is undefined.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(vector_int64_t), | intent(in) | :: | self | |||
| integer(kind=default_int), | intent(in) | :: | index |
.true. when there are no live elements.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(vector_int64_t), | intent(in) | :: | self |
Remove and return the last element. ERROR_BOUNDS when empty, in
which case the vector is unchanged.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(vector_int64_t), | intent(inout) | :: | self | |||
| integer(kind=int64), | intent(out) | :: | value | |||
| type(error_t), | intent(inout), | optional | :: | err |
Append one element. ERROR_ALLOC if storage cannot be grown, in which
case the vector is unchanged.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(vector_int64_t), | intent(inout) | :: | self | |||
| integer(kind=int64), | intent(in) | :: | value | |||
| type(error_t), | intent(inout), | optional | :: | err |
Make room for at least n elements. size() is unchanged.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(vector_int64_t), | intent(inout) | :: | self | |||
| integer(kind=default_int), | intent(in) | :: | n | |||
| type(error_t), | intent(inout), | optional | :: | err |
Set the length to n, padding with fill when growing and dropping
elements from the end when shrinking.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(vector_int64_t), | intent(inout) | :: | self | |||
| integer(kind=default_int), | intent(in) | :: | n | |||
| integer(kind=int64), | intent(in) | :: | fill | |||
| type(error_t), | intent(inout), | optional | :: | err |
Overwrite element index, 1-based. ERROR_BOUNDS when out of range;
this never extends the vector, use push_back or resize for that.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(vector_int64_t), | intent(inout) | :: | self | |||
| integer(kind=default_int), | intent(in) | :: | index | |||
| integer(kind=int64), | intent(in) | :: | value | |||
| type(error_t), | intent(inout), | optional | :: | err |
Release capacity beyond size().
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(vector_int64_t), | intent(inout) | :: | self | |||
| type(error_t), | intent(inout), | optional | :: | err |
Number of live elements.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(vector_int64_t), | intent(in) | :: | self |
Hand the storage over to array, exactly sized, without copying the
elements. The vector is left empty and without storage.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(vector_int64_t), | intent(inout) | :: | self | |||
| integer(kind=int64), | intent(out), | allocatable | :: | array(:) | ||
| type(error_t), | intent(inout), | optional | :: | err |
type :: vector_int64_t !! Growable array of integer(int64). integer(default_int), private :: n_items = 0 !! Number of live elements. Always `0 <= n_items <= capacity()`. integer(int64), allocatable, private :: items(:) !! Backing storage. Only `items(1:n_items)` is meaningful; the rest is !! spare capacity whose contents are unspecified. contains procedure :: push_back => vec_int64_push_back procedure :: append => vec_int64_append procedure :: pop_back => vec_int64_pop_back procedure :: at => vec_int64_at procedure :: set => vec_int64_set procedure :: get_unchecked => vec_int64_get_unchecked procedure :: size => vec_int64_size procedure :: capacity => vec_int64_capacity procedure :: is_empty => vec_int64_is_empty procedure :: reserve => vec_int64_reserve procedure :: resize => vec_int64_resize procedure :: clear => vec_int64_clear procedure :: shrink_to_fit => vec_int64_shrink_to_fit procedure :: as_array => vec_int64_as_array procedure :: take => vec_int64_take procedure :: destroy => vec_int64_destroy end type vector_int64_t