From f4b1d96a55eeaab280b423e95bb493fa23e69e8b Mon Sep 17 00:00:00 2001 From: Alain Miniussi Date: Wed, 10 Sep 2014 11:03:11 +0200 Subject: [PATCH] Test_any loop was only testing the first request. test_any was actually only testing the first request due to a typo in the for loop. (cherry picked from commit 6c597245a2f72e861781c38bc53b68be3c83d5f5) --- include/boost/mpi/nonblocking.hpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/boost/mpi/nonblocking.hpp b/include/boost/mpi/nonblocking.hpp index a2d2e34..09bc833 100644 --- a/include/boost/mpi/nonblocking.hpp +++ b/include/boost/mpi/nonblocking.hpp @@ -138,10 +138,12 @@ template optional > test_any(ForwardIterator first, ForwardIterator last) { - for (ForwardIterator current = first; first != last; ++first) { + while (first != last) { // Check if we have found a completed request. If so, return it. - if (optional result = current->test()) - return std::make_pair(*result, current); + if (optional result = first->test()) { + return std::make_pair(*result, first); + } + ++first; } // We found nothing