event/PollGroupWinSelect: use range-based `for`
This commit is contained in:
parent
7e7a1613cf
commit
92fc53ebef
|
@ -150,19 +150,19 @@ PollGroupWinSelect::ReadEvents(PollResultGeneric &result,
|
|||
if (ret == 0 || ret == SOCKET_ERROR)
|
||||
return;
|
||||
|
||||
for (size_t i = 0; i < read_set.Size(); ++i)
|
||||
items[read_set[i]].events |= READ;
|
||||
for (const auto i : read_set)
|
||||
items[i].events |= READ;
|
||||
|
||||
for (size_t i = 0; i < write_set.Size(); ++i)
|
||||
items[write_set[i]].events |= WRITE;
|
||||
for (const auto i : write_set)
|
||||
items[i].events |= WRITE;
|
||||
|
||||
for (size_t i = 0; i < except_set.Size(); ++i)
|
||||
items[except_set[i]].events |= WRITE;
|
||||
for (const auto i : except_set)
|
||||
items[i].events |= WRITE;
|
||||
|
||||
for (auto i = items.begin(); i != items.end(); ++i)
|
||||
if (i->second.events != 0) {
|
||||
result.Add(i->second.events, i->second.obj);
|
||||
i->second.events = 0;
|
||||
for (auto &i : items)
|
||||
if (i.second.events != 0) {
|
||||
result.Add(i.second.events, i.second.obj);
|
||||
i.second.events = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -84,6 +84,14 @@ public:
|
|||
assert(!IsEmpty());
|
||||
--set.fd_count;
|
||||
}
|
||||
|
||||
const auto *begin() const noexcept {
|
||||
return set.fd_array;
|
||||
}
|
||||
|
||||
const auto *end() const noexcept {
|
||||
return set.fd_array + set.fd_count;
|
||||
}
|
||||
};
|
||||
|
||||
class PollGroupWinSelect
|
||||
|
|
Loading…
Reference in New Issue