Added get_ref
Gets the reference of a value. Useful for primitive values like int, char, double, size_t, etc. The only collections with this function are associative collections (when getting the value) and lists (working as an update method). Other collections have not received this function because they are either sorted by the values so changing it would break the structure or because removing and adding back again the element is done instantaneously.
This commit is contained in:
1 parent
be9c5af7cb
commit
a37207e9d7
6 files changed
+80
No files matched your search
@@ -86,6 +86,7 @@ Sequences Input / Output
|
||||
|
||||
* [\_front()](#list_front)
|
||||
* [\_get()](#list_get)
|
||||
* [\_get_ref()](#list_get_ref)
|
||||
* [\_back()](#list_back)
|
||||
* [\_indexof()](#list_indexof)
|
||||
* [\_contains()](#list_contains)
|
||||
@@ -449,6 +450,25 @@ Returns the element located at the given index if the list is not empty.
|
||||
1. `V` - The element in the list located at the given index.
|
||||
2. `0` or `NULL` - If the list is empty, or if `index` is greater than or equal to the list `count`.
|
||||
|
||||
## [<span id="list_get_ref"> \_get\_ref() </span>](#list_function_index)
|
||||
|
||||
Returns a reference to the element located at the given index if the list is not empty.
|
||||
|
||||
#### Declaration
|
||||
|
||||
> `FMOD V *PFX##_get_ref(SNAME *_list_, size_t index);`
|
||||
|
||||
#### Parameters
|
||||
|
||||
1. `SNAME *_list_` - Target list.
|
||||
2. `size_t index` - Index to retrieve a reference to an element.
|
||||
* Can't be greater than or equal to the list `count`.
|
||||
|
||||
#### Returns
|
||||
|
||||
1. `V*` - A reference to the element in the list located at the given index.
|
||||
2. `NULL` - If the list is empty, or if `index` is greater than or equal to the list `count`.
|
||||
|
||||
## [<span id="list_back"> \_back() </span>](#list_function_index)
|
||||
|
||||
Returns the last element (located at index `count - 1`) if the list is not empty.
|
||||
|
||||
Reference in new issue
Block a user