Skip to content
Snippets Groups Projects
Commit 84821386 authored by Maxence Naud's avatar Maxence Naud
Browse files

Merge branch 'fix/GenericOp' into 'standardization'

[Fix] Memory leak due to containers serialization

See merge request !3
parents ac37b61c dde40b01
No related branches found
No related tags found
2 merge requests!15Remove CParameter memory leak,!3[Fix] Memory leak due to containers serialization
Pipeline #31878 passed
......@@ -110,7 +110,7 @@ public:
template<typename T, typename VT = _Decay_if_not_any<T>, std::enable_if_t<std::is_copy_constructible<VT>::value, bool> = true>
explicit _any(T&& value)
: _M_manager(&Manager<VT>::manage),
_M_data(new VT{std::forward<T>(value)})
_M_data(new VT{std::forward<T>(value)})
{}
~_any()
......
......@@ -14,6 +14,10 @@
#include <map>
#include <vector>
#include <type_traits>
#include <typeinfo>
#include <assert.h>
#include "aidge/utils/Any.hpp"
......@@ -27,7 +31,7 @@ private:
inline _ValueType& any_cast_ref(const _any& __any)
{
using _Up = std::remove_cv_t<std::remove_reference_t<_ValueType>>;
assert((std::__or_<std::is_reference<_ValueType>, std::is_copy_constructible<_ValueType>>::value && "Template argument must be a reference or CopyConstructible type"));
assert(((std::is_reference<_ValueType>::value || std::is_copy_constructible<_ValueType>::value) && "Template argument must be a reference or CopyConstructible type"));
assert((std::is_constructible<_ValueType, const _Up&>::value && "Template argument must be constructible from a const value."));
assert(std::is_object<_Up>::value);
assert(__any.type() == typeid(_Up));
......@@ -93,14 +97,6 @@ public:
private:
std::map<std::string, std::size_t> m_Params; // { Param name : offset }
///\brief Map to check type error
/* Note : i tried this : `std::map<std::string, std::type_info const *> mTypes;`
but looks like the type_ingo object was destroyed.
I am not a hugde fan of storing a string and making string comparison.
Maybe we can use a custom enum type (or is there a standard solution ?)
*/
std::map<std::string, std::string> m_Types;
///\brief All raw pointers to parameters values concatenated. Use custom any class compatible with C++14.
std::vector<_any> m_Buffer = {};
};
......
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