Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines.
[simgrid.git] / src / smpi / mpi / smpi_group.cpp
index 8d2d653..d6eec8f 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2020. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2010-2021. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -207,20 +207,17 @@ int Group::excl(int n, const int *ranks, MPI_Group * newgroup){
   int oldsize = size_;
   int newsize = oldsize - n;
   *newgroup = new  Group(newsize);
-  auto* to_exclude = new int[size_];
-  for (int i     = 0; i < oldsize; i++)
-    to_exclude[i]=0;
-  for (int i            = 0; i < n; i++)
-    to_exclude[ranks[i]]=1;
+  std::vector<bool> to_exclude(size_, false);
+  for (int i = 0; i < n; i++)
+    to_exclude[ranks[i]] = true;
   int j = 0;
   for (int i = 0; i < oldsize; i++) {
-    if(to_exclude[i]==0){
+    if (not to_exclude[i]) {
       s4u::Actor* actor = this->actor(i);
       (*newgroup)->set_mapping(actor, j);
       j++;
     }
   }
-  delete[] to_exclude;
   return MPI_SUCCESS;
 }