Skip to content

Commit

Permalink
Merge pull request #14970 from drwells/trilinos-vector-noexcept
Browse files Browse the repository at this point in the history
Be more correct in our noexcept usage.
  • Loading branch information
bangerth committed Mar 25, 2023
2 parents 67afa2b + af78690 commit a8c0bd1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion include/deal.II/lac/trilinos_vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -500,8 +500,12 @@ namespace TrilinosWrappers
/**
* Move constructor. Creates a new vector by stealing the internal data
* of the vector @p v.
*
* @note In order for this constructor to leave the moved-from object in a
* valid state it must allocate memory (in this case, an empty
* Epetra_FEVector) - hence it cannot be marked as noexcept.
*/
Vector(Vector &&v) noexcept;
Vector(Vector &&v); // NOLINT

/**
* Destructor.
Expand Down
4 changes: 3 additions & 1 deletion source/lac/trilinos_vector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,11 @@ namespace TrilinosWrappers



Vector::Vector(Vector &&v) noexcept
Vector::Vector(Vector &&v) // NOLINT
: Vector()
{
// initialize a minimal, valid object and swap
static_cast<Subscriptor &>(*this) = static_cast<Subscriptor &&>(v);
swap(v);
}

Expand Down Expand Up @@ -499,6 +500,7 @@ namespace TrilinosWrappers
Vector &
Vector::operator=(Vector &&v) noexcept
{
static_cast<Subscriptor &>(*this) = static_cast<Subscriptor &&>(v);
swap(v);
return *this;
}
Expand Down

0 comments on commit a8c0bd1

Please sign in to comment.