introduce a smart_copy internal function and fix sparse matrices with non POD scalar type

This commit is contained in:
Gael Guennebaud
2011-06-09 19:04:06 +02:00
parent 8c8ab9ae10
commit 6d3dee1b66
2 changed files with 24 additions and 3 deletions

View File

@@ -218,8 +218,8 @@ class CompressedStorage
Index* newIndices = new Index[size];
size_t copySize = std::min(size, m_size);
// copy
memcpy(newValues, m_values, copySize * sizeof(Scalar));
memcpy(newIndices, m_indices, copySize * sizeof(Index));
internal::smart_copy(m_values, m_values+copySize, newValues);
internal::smart_copy(m_indices, m_indices+copySize, newIndices);
// delete old stuff
delete[] m_values;
delete[] m_indices;