Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Sonar is right: a std:vector is just fine here.
[simgrid.git] / src / smpi / mpi / smpi_comm.cpp
index 83d6612..7a19277 100644 (file)
@@ -654,8 +654,8 @@ unsigned int Comm::get_collectives_count()
   if (this==MPI_COMM_UNINITIALIZED){
     return smpi_process()->comm_world()->get_collectives_count();
   }else if(this == MPI_COMM_WORLD || this == smpi_process()->comm_world()){
-    if (not collectives_counts_)
-      collectives_counts_ = std::make_unique<unsigned int[]>(this->size());
+    if (collectives_counts_.empty())
+      collectives_counts_.resize(this->size());
     return collectives_counts_[this->rank()];
   }else{
     return collectives_count_;
@@ -667,8 +667,8 @@ void Comm::increment_collectives_count()
    if (this==MPI_COMM_UNINITIALIZED){
     smpi_process()->comm_world()->increment_collectives_count();
   }else if (this == MPI_COMM_WORLD || this == smpi_process()->comm_world()){
-    if (not collectives_counts_)
-      collectives_counts_ = std::make_unique<unsigned int[]>(this->size());
+    if (collectives_counts_.empty())
+      collectives_counts_.resize(this->size());
     collectives_counts_[this->rank()]++;
   }else{
     collectives_count_++;