event/PollBackend: add Item constructor
This commit is contained in:
parent
b9b02b4ff2
commit
b1b731340e
@ -36,10 +36,9 @@ PollBackend::Add(int fd, unsigned events, void *obj) noexcept
|
||||
e.events = events;
|
||||
e.revents = 0;
|
||||
|
||||
auto i = items.emplace(fd, Item{}).first;
|
||||
auto &item = i->second;
|
||||
item.index = index;
|
||||
item.obj = obj;
|
||||
items.emplace(std::piecewise_construct,
|
||||
std::forward_as_tuple(fd),
|
||||
std::forward_as_tuple(index, obj));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,12 @@ class PollBackend
|
||||
{
|
||||
std::size_t index;
|
||||
void *obj;
|
||||
|
||||
constexpr Item(std::size_t _index, void *_obj) noexcept
|
||||
:index(_index), obj(_obj) {}
|
||||
|
||||
Item(const Item &) = delete;
|
||||
Item &operator=(const Item &) = delete;
|
||||
};
|
||||
|
||||
std::vector<pollfd> poll_events;
|
||||
|
Loading…
Reference in New Issue
Block a user