Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Replace fixed-size C-style arrays with std::array.
[simgrid.git] / src / smpi / mpi / smpi_request.cpp
index 5dd26dc..e0c6ec5 100644 (file)
@@ -18,6 +18,7 @@
 #include "src/smpi/include/smpi_actor.hpp"
 
 #include <algorithm>
+#include <array>
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_request, smpi, "Logging specific to SMPI (request)");
 
@@ -337,8 +338,8 @@ void Request::sendrecv(const void *sendbuf, int sendcount, MPI_Datatype sendtype
                        void *recvbuf, int recvcount, MPI_Datatype recvtype, int src, int recvtag,
                        MPI_Comm comm, MPI_Status * status)
 {
-  MPI_Request requests[2];
-  MPI_Status stats[2];
+  std::array<MPI_Request, 2> requests;
+  std::array<MPI_Status, 2> stats;
   int myid = simgrid::s4u::this_actor::get_pid();
   if ((comm->group()->actor(dst)->get_pid() == myid) && (comm->group()->actor(src)->get_pid() == myid)) {
     Datatype::copy(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype);
@@ -352,8 +353,8 @@ void Request::sendrecv(const void *sendbuf, int sendcount, MPI_Datatype sendtype
   }
   requests[0] = isend_init(sendbuf, sendcount, sendtype, dst, sendtag, comm);
   requests[1] = irecv_init(recvbuf, recvcount, recvtype, src, recvtag, comm);
-  startall(2, requests);
-  waitall(2, requests, stats);
+  startall(2, requests.data());
+  waitall(2, requests.data(), stats.data());
   unref(&requests[0]);
   unref(&requests[1]);
   if(status != MPI_STATUS_IGNORE) {