#include using namespace icinga; bool foogetter(const Object::Ptr& object, string *key) { DynamicObject::Ptr dobj = dynamic_pointer_cast(object); return dobj->GetConfig()->GetProperty("foo", key); } bool foo(const Object::Ptr& object) { DynamicObject::Ptr dobj = dynamic_pointer_cast(object); string value; return dobj->GetConfig()->GetProperty("foo", &value); } int main(int argc, char **argv) { for (int i = 0; i < 1000000; i++) { DynamicObject::Ptr dobj = make_shared(); dobj->GetConfig()->SetProperty("foo", "bar"); dobj->Commit(); } ObjectSet::Ptr filtered = make_shared(ObjectSet::GetAllObjects(), &foo); filtered->Start(); ObjectMap::Ptr m = make_shared(ObjectSet::GetAllObjects(), &foogetter); m->Start(); ObjectMap::Range range = m->GetRange("bar"); cout << distance(range.first, range.second) << " elements" << endl; return 0; }