diff options
author | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-07-09 13:10:32 +1000 |
---|---|---|
committer | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-07-09 13:10:32 +1000 |
commit | 049a16d1b1a683487a0c17014e9f7c477820a132 (patch) | |
tree | 1e8ef2c44cbc7eb154b245f618794776587619b0 /impl/IdSet.hpp | |
parent | f7d846f18354e254353bc417ed1a666c59ef3ea2 (diff) |
Fixed up the newer strategy iteration stuff
Trivial 100000 var case in 15s on my Uni machine.
Diffstat (limited to 'impl/IdSet.hpp')
-rw-r--r-- | impl/IdSet.hpp | 10 |
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(); } |