ForwardIterator current = first;
while (true) {
// Check if we have found a completed request. If so, return it.
- if (optional<status> result = current->test())
- return std::make_pair(*result, current);
+ if (current->m_requests[0] != MPI_REQUEST_NULL &&
+ current->m_requests[1] != MPI_REQUEST_NULL)
+ if (optional<status> result = current->test())
+ return std::make_pair(*result, current);
// Check if this request (and all others before it) are "trivial"
// requests, e.g., they can be represented with a single