Verse Library verse

04 Weak Map

Shows how to initialize, mutate, and reassign a weak map using standard map syntax.

extracted-snippets/documentation/en-us/uefn/map-in-verse/04-weak-map.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/uefn/map-in-verse
# Local doc:  epic-docs/documentation/en-us/uefn/map-in-verse.md
# Section:    Weak Map
ExampleFunction():void=
    var MyWeakMap:weak_map(int, int) = map{} # Supertype of the standard map, so it can be assigned from the standard map
    if: 
        set MyWeakMap[0] = 1 # Same means of mutation of a particular element as the standard map
    then:
        if (Value := MyWeakMap[0]):
            Print("Value of map at key 0 is {Value}")
    set MyWeakMap = map{0 => 2} # Same means of mutation of the entire map as the standard map
Copy full snippet

Comments

    Sign in to vote, comment, or suggest an edit. Sign in