Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit eaa757f

Browse files
committed
Pass by value instead of rvalue ref
This ensures the move constructor is invoked and the caller releases ownership per https://stackoverflow.com/a/71930927
1 parent 89d70d3 commit eaa757f

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

include/numerics/numeric_vector.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ class NumericVector : public ReferenceCountedObject<NumericVector<T>>,
749749
* rows. This is currently only implemented for
750750
* PetscVectors.
751751
*/
752-
virtual void restore_subvector(std::unique_ptr<NumericVector<T>> &&,
752+
virtual void restore_subvector(std::unique_ptr<NumericVector<T>>,
753753
const std::vector<numeric_index_type> &)
754754
{
755755
libmesh_not_implemented();

include/numerics/petsc_vector.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ class PetscVector final : public NumericVector<T>
349349
virtual std::unique_ptr<NumericVector<T>>
350350
get_subvector(const std::vector<numeric_index_type> & rows) override;
351351

352-
virtual void restore_subvector(std::unique_ptr<NumericVector<T>> && subvector,
352+
virtual void restore_subvector(std::unique_ptr<NumericVector<T>> subvector,
353353
const std::vector<numeric_index_type> & rows) override;
354354

355355
private:

src/numerics/petsc_vector.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1433,7 +1433,7 @@ PetscVector<T>::get_subvector(const std::vector<numeric_index_type> & rows)
14331433

14341434
template <typename T>
14351435
void
1436-
PetscVector<T>::restore_subvector(std::unique_ptr<NumericVector<T>> && subvector,
1436+
PetscVector<T>::restore_subvector(std::unique_ptr<NumericVector<T>> subvector,
14371437
const std::vector<numeric_index_type> & rows)
14381438
{
14391439
auto * const petsc_subvector = cast_ptr<PetscVector<T> *>(subvector.get());

0 commit comments

Comments
 (0)