Add construct_at, destroy_at wrappers. Use throughout.

This commit is contained in:
Tobias Schlüter
2022-03-08 20:43:22 +00:00
committed by Rasmus Munk Larsen
parent dfa5176780
commit cd2ba9d03e
18 changed files with 78 additions and 51 deletions

View File

@@ -265,16 +265,16 @@ class KLU : public SparseSolverBase<KLU<MatrixType_> >
template<typename MatrixDerived>
void grab(const EigenBase<MatrixDerived> &A)
{
mp_matrix.~KLUMatrixRef();
::new (&mp_matrix) KLUMatrixRef(A.derived());
internal::destroy_at(&mp_matrix);
internal::construct_at(&mp_matrix, A.derived());
}
void grab(const KLUMatrixRef &A)
{
if(&(A.derived()) != &mp_matrix)
{
mp_matrix.~KLUMatrixRef();
::new (&mp_matrix) KLUMatrixRef(A);
internal::destroy_at(&mp_matrix);
internal::construct_at(&mp_matrix, A);
}
}