We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
map_upsert
package main import "core:fmt" main :: proc() { m: map[string][dynamic]int _, array_ptr, found := map_upsert(&m, "hello", nil) fmt.println(m, found, array_ptr) // map[hello=[]] false &[] append(array_ptr, 1) _, array_ptr, found = map_upsert(&m, "hello", nil) fmt.println(m, found, array_ptr) // map[hello=[]] true &[] (!!!!!!) }
The second println should be map[hello=[1]] true &[1].
map[hello=[1]] true &[1]
The text was updated successfully, but these errors were encountered:
map_insert
The rationale here is for continuously accessing a key in a map and updating the value, based on the old value, inserting it if it wasn't there.
value_ptr := map_upsert(&m, key) append(value_ptr, something)
Sorry, something went wrong.
No branches or pull requests
The second println should be
map[hello=[1]] true &[1]
.The text was updated successfully, but these errors were encountered: