You can just keep a pointer of all objects in the manager and use a QHash using the id parameters to make a key
struct Object
{
void bar(){/* do nothing */}
};
class Manager
{
QHash<Key, Object*> map;
void foo()
{
// do something with 'key's object:
Key key;
map[key]->bar(); // no need to run method for each key/object
}
};
struct Object
{
void bar(){/* do nothing */}
};
class Manager
{
QHash<Key, Object*> map;
void foo()
{
// do something with 'key's object:
Key key;
map[key]->bar(); // no need to run method for each key/object
}
};
To copy to clipboard, switch view to plain text mode
Bookmarks