SparseMatrix< shared_ptr<X> > is not working (patch attached)
Submitted by Takaki Makino
Assigned to Nobody
Link to original bugzilla bug (#710)
Created attachment 404
Proposed patch file for 3.2.0
When we use a custom Scalar type that require initialization
(like std::shared_ptr), the sparse matrix classes do not work correctly.
The problem is that some classes in SparseCore use memcpy() and memmove() functions, which breaks the C++ object semantics.
I found smart_copy function in Core/Memory.h, which seems currently abandoned, but perfectly suitable for replacing these memcpy()s. As a replacement of memmove(), I make an extension to smart_copy, which detects overlapping region and uses C++11 move semantics if applicable.
Attached please find a proposed patch that replaces all memcpy() into smart_copy.
Attachment 404, "Proposed patch file for 3.2.0":