event/PollBackend: use unordered_map::emplace() in Add()

This commit is contained in:
Max Kellermann 2020-10-30 16:23:28 +01:00
parent 0554fe3652
commit ab5d23da11

View File

@ -35,7 +35,9 @@ PollBackend::Add(int fd, unsigned events, void *obj) noexcept
e.fd = fd;
e.events = events;
e.revents = 0;
auto &item = items[fd];
auto i = items.emplace(fd, Item{}).first;
auto &item = i->second;
item.index = index;
item.obj = obj;
return true;