From 049a16d1b1a683487a0c17014e9f7c477820a132 Mon Sep 17 00:00:00 2001 From: Carlo Zancanaro Date: Mon, 9 Jul 2012 13:10:32 +1000 Subject: Fixed up the newer strategy iteration stuff Trivial 100000 var case in 15s on my Uni machine. --- impl/IdSet.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'impl/IdSet.hpp') 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(); } -- cgit v1.2.3