Skip to content

Commit

Permalink
[mpi] define moved-from state for communicator
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcelKoch committed Aug 9, 2024
1 parent a926ffe commit 0a8067b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions include/ginkgo/core/base/mpi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,22 @@ class communicator {
return comm_out;
}

communicator(const communicator& other) = default;

communicator(communicator&& other) { *this = std::move(other); }

communicator& operator=(const communicator& other) = default;

communicator& operator=(communicator&& other)
{
if (this != &other) {
comm_ = std::exchange(other.comm_,
std::make_shared<MPI_Comm>(MPI_COMM_NULL));
force_host_buffer_ = other.force_host_buffer_;
}
return *this;
}

/**
* Return the underlying MPI_Comm object.
*
Expand Down

0 comments on commit 0a8067b

Please sign in to comment.