Move constructors
parent
85b457f1e3
commit
d8b75f6bd0
|
@ -57,13 +57,46 @@ namespace gtsam {
|
||||||
DenseIndex blockStart_; ///< Changes apparent matrix view, see main class comment.
|
DenseIndex blockStart_; ///< Changes apparent matrix view, see main class comment.
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** Construct an empty VerticalBlockMatrix */
|
/** Construct an empty VerticalBlockMatrix */
|
||||||
VerticalBlockMatrix() :
|
VerticalBlockMatrix() : rowStart_(0), rowEnd_(0), blockStart_(0) {
|
||||||
rowStart_(0), rowEnd_(0), blockStart_(0)
|
|
||||||
{
|
|
||||||
variableColOffsets_.push_back(0);
|
variableColOffsets_.push_back(0);
|
||||||
assertInvariants();
|
}
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
~VerticalBlockMatrix() = default;
|
||||||
|
|
||||||
|
// Copy constructor (default)
|
||||||
|
VerticalBlockMatrix(const VerticalBlockMatrix& other) = default;
|
||||||
|
|
||||||
|
// Copy assignment operator (default)
|
||||||
|
VerticalBlockMatrix& operator=(const VerticalBlockMatrix& other) = default;
|
||||||
|
|
||||||
|
// Move constructor
|
||||||
|
VerticalBlockMatrix(VerticalBlockMatrix&& other) noexcept
|
||||||
|
: matrix_(std::move(other.matrix_)),
|
||||||
|
variableColOffsets_(std::move(other.variableColOffsets_)),
|
||||||
|
rowStart_(other.rowStart_),
|
||||||
|
rowEnd_(other.rowEnd_),
|
||||||
|
blockStart_(other.blockStart_) {
|
||||||
|
other.rowStart_ = 0;
|
||||||
|
other.rowEnd_ = 0;
|
||||||
|
other.blockStart_ = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Move assignment operator
|
||||||
|
VerticalBlockMatrix& operator=(VerticalBlockMatrix&& other) noexcept {
|
||||||
|
if (this != &other) {
|
||||||
|
matrix_ = std::move(other.matrix_);
|
||||||
|
variableColOffsets_ = std::move(other.variableColOffsets_);
|
||||||
|
rowStart_ = other.rowStart_;
|
||||||
|
rowEnd_ = other.rowEnd_;
|
||||||
|
blockStart_ = other.blockStart_;
|
||||||
|
|
||||||
|
other.rowStart_ = 0;
|
||||||
|
other.rowEnd_ = 0;
|
||||||
|
other.blockStart_ = 0;
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Construct from a container of the sizes of each vertical block. */
|
/** Construct from a container of the sizes of each vertical block. */
|
||||||
|
|
Loading…
Reference in New Issue