- int* sendbuf = xbt_new(int, 2);
- sendbuf[0] = color;
- sendbuf[1] = key;
- if (myrank == 0) {
- recvbuf = xbt_new(int, 2 * size);
- } else {
- recvbuf = nullptr;
- }
- gather__default(sendbuf, 2, MPI_INT, recvbuf, 2, MPI_INT, 0, this);
- xbt_free(sendbuf);
+ const std::array<int, 2> sendbuf = {{color, key}};
+ std::vector<int> recvbuf;
+ if (myrank == 0)
+ recvbuf.resize(2 * size);
+ gather__default(sendbuf.data(), 2, MPI_INT, recvbuf.data(), 2, MPI_INT, 0, this);