copy assignment

This commit is contained in:
Joachim Schöberl 2019-02-12 01:21:56 +01:00
parent cb635105e9
commit ce75b69cd6

View File

@ -78,6 +78,21 @@ namespace ngcore
if (--(*refcount) == 0) if (--(*refcount) == 0)
MPI_Comm_free(&comm); MPI_Comm_free(&comm);
} }
NgMPI_Comm & operator= (const NgMPI_Comm & c)
{
if (refcount)
if (--(*refcount) == 0)
MPI_Comm_free(&comm);
refcount = c.refcount;
if (refcount) (*refcount)++;
size = c.size;
rank = c.rank;
return *this;
}
operator MPI_Comm() const { return comm; } operator MPI_Comm() const { return comm; }