Skip to content
Snippets Groups Projects
Commit 4848babe authored by Olivier BICHLER's avatar Olivier BICHLER
Browse files

Fixed possible segfault

parent e25123e9
No related branches found
No related tags found
No related merge requests found
......@@ -39,12 +39,8 @@ namespace Aidge {
///\todo managing complex types or excluding non-trivial, non-aggregate types
class DynamicAttributes : public Attributes {
public:
DynamicAttributes() {
mAnyUtils.emplace(typeid(DynamicAttributes), std::unique_ptr<AnyUtils<DynamicAttributes>>(new AnyUtils<DynamicAttributes>()));
}
DynamicAttributes(const std::map<std::string, future_std::any>& attrs): mAttrs(attrs) {
mAnyUtils.emplace(typeid(DynamicAttributes), std::unique_ptr<AnyUtils<DynamicAttributes>>(new AnyUtils<DynamicAttributes>()));
}
DynamicAttributes() = default;
DynamicAttributes(const std::map<std::string, future_std::any>& attrs): mAttrs(attrs) {}
/**
* \brief Returning an Attribute identified by its name
......
......@@ -11,7 +11,11 @@
#include "aidge/utils/DynamicAttributes.hpp"
std::map<std::type_index, std::unique_ptr<Aidge::DynamicAttributes::AnyUtils_>> Aidge::DynamicAttributes::mAnyUtils;
std::map<std::type_index, std::unique_ptr<Aidge::DynamicAttributes::AnyUtils_>> Aidge::DynamicAttributes::mAnyUtils = []() {
std::map<std::type_index, std::unique_ptr<Aidge::DynamicAttributes::AnyUtils_>> m;
m.emplace(typeid(DynamicAttributes), std::unique_ptr<AnyUtils<DynamicAttributes>>(new AnyUtils<DynamicAttributes>()));
return m;
}();
template<> void Aidge::DynamicAttributes::setAttr<future_std::any>(const std::string& name, const future_std::any& value)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment