From 967114eb315d7a87c19227dfa62ce78449c78414 Mon Sep 17 00:00:00 2001 From: Matthias Troyer Date: Mon, 26 Dec 2011 17:29:36 +0000 Subject: [PATCH] Added missing resize of vector, to become compatible with documentation [SVN r76186] --- include/boost/mpi/collectives/gather.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/boost/mpi/collectives/gather.hpp b/include/boost/mpi/collectives/gather.hpp index 4f39392..70dfd65 100644 --- a/include/boost/mpi/collectives/gather.hpp +++ b/include/boost/mpi/collectives/gather.hpp @@ -131,7 +131,12 @@ void gather(const communicator& comm, const T* in_values, int n, std::vector& out_values, int root) { - ::boost::mpi::gather(comm, in_values, n, &out_values[0], root); + if (comm.rank() == root) { + out_values.resize(comm.size() * n); + ::boost::mpi::gather(comm, in_values, n, &out_values[0], root); + } + else + ::boost::mpi::gather(comm, in_values, n, root); } template