summaryrefslogtreecommitdiff
path: root/impl/IdSet.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'impl/IdSet.hpp')
-rw-r--r--impl/IdSet.hpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/impl/IdSet.hpp b/impl/IdSet.hpp
index 99f89cc..950b1e1 100644
--- a/impl/IdSet.hpp
+++ b/impl/IdSet.hpp
@@ -39,6 +39,16 @@ class IdSet {
}
}
+ IdSet inverse() const {
+ IdSet other(_range);
+ for (unsigned int i = 0; i < _range; ++i) {
+ if (_set.find(i) == _set.end()) {
+ other._set.insert(i);
+ }
+ }
+ return other;
+ }
+
bool contains(const T& obj) const {
return _set.find(obj.id()) != _set.end();
}