mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 05:50:30 +00:00
Fix typo in manual
See IRC logs around Sun May 24 22:06:26 EDT 2015 for details
This commit is contained in:
@@ -345,15 +345,15 @@ optimization for types that have copying semantics:
|
||||
## puts a (key, value)-pair into `t`. The semantics of string require
|
||||
## a copy here:
|
||||
let idx = findInsertionPosition(key)
|
||||
t[idx] = key
|
||||
t[idx] = val
|
||||
t[idx].key = key
|
||||
t[idx].val = val
|
||||
|
||||
proc `[]=`*(t: var Table, key: string{call}, val: string{call}) =
|
||||
## puts a (key, value)-pair into `t`. Optimized version that knows that
|
||||
## the strings are unique and thus don't need to be copied:
|
||||
let idx = findInsertionPosition(key)
|
||||
shallowCopy t[idx], key
|
||||
shallowCopy t[idx], val
|
||||
shallowCopy t[idx].key, key
|
||||
shallowCopy t[idx].val, val
|
||||
|
||||
var t: Table
|
||||
# overloading resolution ensures that the optimized []= is called here:
|
||||
|
||||
Reference in New Issue
Block a user