Skip to content

Commit

Permalink
Be more correct in our noexcept usage.
Browse files Browse the repository at this point in the history
  • Loading branch information
drwells committed Mar 24, 2023
1 parent 216c7a9 commit af78690
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 af78690

Please sign in to comment.