add effectsOf to map in the std/sets module (#20760)
This commit is contained in:
parent
4b24d85907
commit
92e525d2a6
1 changed files with 4 additions and 1 deletions
|
|
@ -50,6 +50,9 @@
|
||||||
import
|
import
|
||||||
hashes, math
|
hashes, math
|
||||||
|
|
||||||
|
when not defined(nimHasEffectsOf):
|
||||||
|
{.pragma: effectsOf.}
|
||||||
|
|
||||||
{.pragma: myShallow.}
|
{.pragma: myShallow.}
|
||||||
# For "integer-like A" that are too big for intsets/bit-vectors to be practical,
|
# For "integer-like A" that are too big for intsets/bit-vectors to be practical,
|
||||||
# it would be best to shrink hcode to the same size as the integer. Larger
|
# it would be best to shrink hcode to the same size as the integer. Larger
|
||||||
|
|
@ -556,7 +559,7 @@ proc `==`*[A](s, t: HashSet[A]): bool =
|
||||||
|
|
||||||
s.counter == t.counter and s <= t
|
s.counter == t.counter and s <= t
|
||||||
|
|
||||||
proc map*[A, B](data: HashSet[A], op: proc (x: A): B {.closure.}): HashSet[B] =
|
proc map*[A, B](data: HashSet[A], op: proc (x: A): B {.closure.}): HashSet[B] {.effectsOf: op.} =
|
||||||
## Returns a new set after applying `op` proc on each of the elements of
|
## Returns a new set after applying `op` proc on each of the elements of
|
||||||
##`data` set.
|
##`data` set.
|
||||||
##
|
##
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue