-#define CHECK_WIN_LOCKED(win)\
- if(opened_==0){ /*check that post/start has been done*/\
- int locked=0;\
- for (auto const& it : win->lockers_)\
- if (it == comm_->rank())\
- locked = 1;\
- if(locked != 1)\
- return MPI_ERR_WIN;\
+#define CHECK_WIN_LOCKED(win) \
+ if (opened_ == 0) { /*check that post/start has been done*/ \
+ bool locked = std::any_of(begin(win->lockers_), end(win->lockers_), [this](int it) { return it == this->rank_; }); \
+ if (not locked) \
+ return MPI_ERR_WIN; \