summary refs log tree commit diff stats
path: root/lib/system.nim
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2013-12-30 14:25:05 +0200
committerZahary Karadjov <zahary@gmail.com>2013-12-30 14:25:05 +0200
commit88873f7965d04cc2bea56f2b957e3b506442c582 (patch)
tree01f600edee149231df1c5acc78d3784a42a404b4 /lib/system.nim
parent046d829e5d9c07cd829de9fa4ec2c9a07bbcf859 (diff)
downloadNim-88873f7965d04cc2bea56f2b957e3b506442c582.tar.gz
add incl/excl for sets accepting accepting other sets
Diffstat (limited to 'lib/system.nim')
-rw-r--r--lib/system.nim8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/system.nim b/lib/system.nim
index 978fae1a6..241b0bd03 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -422,10 +422,18 @@ proc incl*[T](x: var set[T], y: T) {.magic: "Incl", noSideEffect.}
   ## includes element ``y`` to the set ``x``. This is the same as
   ## ``x = x + {y}``, but it might be more efficient.
 
+template incl*[T](s: var set[T], flags: set[T]) =
+  ## includes the set of flags to the set ``x``.
+  s = s + flags
+
 proc excl*[T](x: var set[T], y: T) {.magic: "Excl", noSideEffect.}
   ## excludes element ``y`` to the set ``x``. This is the same as
   ## ``x = x - {y}``, but it might be more efficient.
 
+template excl*[T](s: var set[T], flags: set[T]) =
+  ## excludes the set of flags to ``x``.
+  s = s - flags
+
 proc card*[T](x: set[T]): int {.magic: "Card", noSideEffect.}
   ## returns the cardinality of the set ``x``, i.e. the number of elements
   ## in the set.