Constify Qt containers passed to ranges

This constifies a few mutable Qt containers passed to std::ranges to improve the efficiency.
This commit is contained in:
Fushan Wen 2024-05-12 09:51:44 +08:00 committed by Vlad Zahorodnii
parent d2d92cdfd2
commit 7a2e6bb58e
2 changed files with 4 additions and 4 deletions

View file

@ -287,10 +287,10 @@ void Connection::processEvents()
break;
}
case LIBINPUT_EVENT_DEVICE_REMOVED: {
auto it = std::ranges::find_if(m_devices, [&event](Device *d) {
auto it = std::ranges::find_if(std::as_const(m_devices), [&event](Device *d) {
return event->device() == d;
});
if (it == m_devices.end()) {
if (it == m_devices.cend()) {
// we don't know this device
break;
}

View file

@ -513,10 +513,10 @@ void X11WindowedBackend::updateWindowTitle()
void X11WindowedBackend::handleClientMessage(xcb_client_message_event_t *event)
{
auto it = std::ranges::find_if(m_outputs, [event](X11WindowedOutput *output) {
auto it = std::ranges::find_if(std::as_const(m_outputs), [event](X11WindowedOutput *output) {
return output->window() == event->window;
});
if (it == m_outputs.end()) {
if (it == m_outputs.cend()) {
return;
}
if (event->type == m_protocols && m_protocols != XCB_ATOM_NONE) {