mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 21:33:00 +02:00
Checking that T is in fact derived from Dependency
This commit is contained in:
parent
1db3592d4c
commit
e40961df12
1 changed files with 4 additions and 1 deletions
|
@ -16,6 +16,7 @@
|
|||
#include <QString>
|
||||
|
||||
#include <typeinfo>
|
||||
#include <assert.h>
|
||||
|
||||
class DependencyManager {
|
||||
public:
|
||||
|
@ -56,7 +57,9 @@ T* DependencyManager::get() {
|
|||
|
||||
// Found no instance in hash so we create one.
|
||||
T* newInstance = new T();
|
||||
getInstanceHash().insert(typeId, dynamic_cast<Dependency*>(newInstance));
|
||||
instance = dynamic_cast<Dependency*>(newInstance);
|
||||
assert(instance != NULL); // If this triggers, check that T is derived from Dependency
|
||||
getInstanceHash().insert(typeId, instance);
|
||||
return newInstance;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue