Open
Description
Hi everyone,
I tried to serialize a class member of type std::map<std::string, ChLinkTSDA> with archive_out << CHNVP(map_);, but unfortunately, this led to a segmentation fault.
While looking for the cause of this, I came across another issue, which I wondered if was related to the first issue. If you want to do something like this
std::map<std::string, ChLinkTSDA> map_{
{"l1", ChLinkTSDA()}
};
a 'bad_alloc' exception is thrown. I could eliminate this by adding the following line to the copy constructor of ChLinkTSDA:
m_jacobians = other.m_jacobians ? new SpringJacobians(*other.m_jacobians) : nullptr;
and change the copying of m_variables to:
m_variables = other.m_variables ? new ChVariablesGenericDiagonalMass(*other.m_variables) : nullptr;
But in the end, I couldn't solve the serialization problem. Maybe you have a solution.
Thanks and best regards,
Paul
Metadata
Metadata
Assignees
Labels
No labels