From 3922c315e1ee137e2ff6656744ff9ef54cc03d9d Mon Sep 17 00:00:00 2001 From: Gareth Lloyd Date: Thu, 30 Jan 2025 10:54:12 +0000 Subject: [PATCH] Added mgp_list_reserve and List::Reserve --- pages/custom-query-modules/c/c-api.mdx | 1 + pages/custom-query-modules/cpp/cpp-api.md | 1 + 2 files changed, 2 insertions(+) diff --git a/pages/custom-query-modules/c/c-api.mdx b/pages/custom-query-modules/c/c-api.mdx index 65ad739b0..1bba04816 100644 --- a/pages/custom-query-modules/c/c-api.mdx +++ b/pages/custom-query-modules/c/c-api.mdx @@ -113,6 +113,7 @@ Memgraph in order to use them. | enum [mgp_error](#variable-mgp-error) | **[mgp_list_contains_deleted](#function-mgp-list-contains-deleted)**(struct mgp_list * list, int * result)
Result is non-zero if the given list contains any deleted values, otherwise 0. | | enum [mgp_error](#variable-mgp-error) | **[mgp_list_append](#function-mgp-list-append)**(struct mgp_list * list, struct mgp_value * val)
Append a copy of mgp_value to mgp_list if capacity allows. | | enum [mgp_error](#variable-mgp-error) | **[mgp_list_append_extend](#function-mgp-list-append-extend)**(struct mgp_list * list, struct mgp_value * val)
Append a copy of mgp_value to mgp_list increasing capacity if needed. | +| enum [mgp_error](#variable-mgp-error) | **[mgp_list_reserve](#function-mgp-list-reserve)**(struct mgp_list * list, size_t n)
Ensure the underlying capacity of the mgp_list is at least n. | | enum [mgp_error](#variable-mgp-error) | **[mgp_list_size](#function-mgp-list-size)**(struct mgp_list * list, size_t * result)
Get the number of elements stored in mgp_list. | | enum [mgp_error](#variable-mgp-error) | **[mgp_list_capacity](#function-mgp-list-capacity)**(struct mgp_list * list, size_t * result)
Get the total number of elements for which there's already allocated memory in mgp_list. | | enum [mgp_error](#variable-mgp-error) | **[mgp_list_at](#function-mgp-list-at)**(struct mgp_list * list, size_t index, struct mgp_value ** result)
Get the element in mgp_list at given position. | diff --git a/pages/custom-query-modules/cpp/cpp-api.md b/pages/custom-query-modules/cpp/cpp-api.md index 965501a97..5a16729fb 100644 --- a/pages/custom-query-modules/cpp/cpp-api.md +++ b/pages/custom-query-modules/cpp/cpp-api.md @@ -1786,6 +1786,7 @@ List(List &&other) noexcept | `Empty` | Returns whether the list is empty. | | `Append` | Appends the given `value` to the list. | | `AppendExtend` | Extends the list and appends the given `value` to it. | +| `Reserve` | Ensure underlying capacity is at least `n`. | | `begin`
`end`
`cbegin`
`cend` | Returns the beginning/end of the `List` iterator. | | `ToString` | Returns the list's string representation. |