Added the []= overloadable operator and implemented it for vector, map, and string

This commit is contained in:
Nathan Braswell
2015-06-27 11:46:31 -04:00
parent b18c18ec30
commit dacfee6d22
13 changed files with 71 additions and 1 deletions

View File

@@ -29,6 +29,9 @@ obj map<T,U> {
fun find_index(key: T): int {
return keys.find_index(key)
}
fun operator[]=(key: T, value: U) {
set(key,value)
}
fun set(key: T, value: U) {
var keyIdx = find_index(key)
if (keyIdx >= 0) {