Map
operator[] (key) [Map template]
Gets a reference to an entry with key key
. This will create the entry if it does not exist. If there is insufficient memory to allocate a new entry, it will cause a SOS panic. Using set()
can provide more control over error conditions.
// PROTOTYPE
template<typename T>
ValueT& operator[](const T& key);
// EXAMPLE
Map<String, int> m1({ {"a", 123}, {"b", 456} });
m1["a"] = 999;