summaryrefslogtreecommitdiff
path: root/lib/persistance.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/persistance.h')
-rw-r--r--lib/persistance.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/persistance.h b/lib/persistance.h
index f797157..6e23272 100644
--- a/lib/persistance.h
+++ b/lib/persistance.h
@@ -10,6 +10,7 @@
#include <stdexcept>
#include <string>
#include <string_view>
+#include <type_traits>
#include <utility>
#include <vector>
@@ -155,15 +156,17 @@ namespace Persistanace {
}
template<typename T> static void addFactory() __attribute__((constructor));
- static void addFactory(const std::string_view, std::function<std::unique_ptr<Persistable>()>);
+ static void addFactory(const std::string_view, std::function<std::unique_ptr<Persistable>()>,
+ std::function<std::shared_ptr<Persistable>()>);
static std::unique_ptr<Persistable> callFactory(const std::string_view);
+ static std::shared_ptr<Persistable> callSharedFactory(const std::string_view);
};
template<typename T>
void
Persistable::addFactory()
{
- addFactory(typeName<T>(), std::make_unique<T>);
+ addFactory(typeName<T>(), std::make_unique<T>, std::make_shared<T>);
}
template<typename T>