Add move constructor and assignment to AutoDiffMatrix.

This is necessary, and done using swap(), since (current version)
Eigen::SparseMatrix does not support move semantics.
This commit is contained in:
Atgeirr Flø Rasmussen 2015-08-27 11:39:31 +02:00 committed by babrodtk
parent 097542a527
commit 61c352ca3b

View File

@ -87,6 +87,26 @@ namespace Opm
AutoDiffMatrix(const AutoDiffMatrix& other) = default;
AutoDiffMatrix& operator=(const AutoDiffMatrix& other) = default;
AutoDiffMatrix(AutoDiffMatrix&& other)
{
swap(other);
}
AutoDiffMatrix& operator=(AutoDiffMatrix&& other)
{
swap(other);
return *this;
}
void swap(AutoDiffMatrix& other)
{
std::swap(type_, other.type_);