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.events = events;
|
||||||
e.revents = 0;
|
e.revents = 0;
|
||||||
|
|
||||||
auto i = items.emplace(fd, Item{}).first;
|
items.emplace(std::piecewise_construct,
|
||||||
auto &item = i->second;
|
std::forward_as_tuple(fd),
|
||||||
item.index = index;
|
std::forward_as_tuple(index, obj));
|
||||||
item.obj = obj;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,12 @@ class PollBackend
|
|||||||
{
|
{
|
||||||
std::size_t index;
|
std::size_t index;
|
||||||
void *obj;
|
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;
|
std::vector<pollfd> poll_events;
|
||||||
|
Loading…
Reference in New Issue
Block a user