Revert "Fix typo in manual"
This commit is contained in:
parent
31d0f79d9d
commit
d8921a4485
1 changed files with 4 additions and 4 deletions
|
|
@ -345,15 +345,15 @@ optimization for types that have copying semantics:
|
||||||
## puts a (key, value)-pair into `t`. The semantics of string require
|
## puts a (key, value)-pair into `t`. The semantics of string require
|
||||||
## a copy here:
|
## a copy here:
|
||||||
let idx = findInsertionPosition(key)
|
let idx = findInsertionPosition(key)
|
||||||
t[idx].key = key
|
t[idx] = key
|
||||||
t[idx].val = val
|
t[idx] = val
|
||||||
|
|
||||||
proc `[]=`*(t: var Table, key: string{call}, val: string{call}) =
|
proc `[]=`*(t: var Table, key: string{call}, val: string{call}) =
|
||||||
## puts a (key, value)-pair into `t`. Optimized version that knows that
|
## puts a (key, value)-pair into `t`. Optimized version that knows that
|
||||||
## the strings are unique and thus don't need to be copied:
|
## the strings are unique and thus don't need to be copied:
|
||||||
let idx = findInsertionPosition(key)
|
let idx = findInsertionPosition(key)
|
||||||
shallowCopy t[idx].key, key
|
shallowCopy t[idx], key
|
||||||
shallowCopy t[idx].val, val
|
shallowCopy t[idx], val
|
||||||
|
|
||||||
var t: Table
|
var t: Table
|
||||||
# overloading resolution ensures that the optimized []= is called here:
|
# overloading resolution ensures that the optimized []= is called here:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue