refactor: KeyState::updateModifierState, use std::ranges::set_difference in place of std::set_difference

This commit is contained in:
sithlord48
2025-08-05 21:44:14 -04:00
committed by Nick Bolton
parent 0cbc922478
commit d20887f34a

View File

@ -1110,14 +1110,8 @@ void KeyState::updateModifierKeyState(
// get the modifier buttons that were pressed or released
deskflow::KeyMap::ButtonToKeyMap pressed;
deskflow::KeyMap::ButtonToKeyMap released;
std::set_difference(
oldKeys.begin(), oldKeys.end(), newKeys.begin(), newKeys.end(), std::inserter(released, released.end()),
ButtonToKeyLess()
);
std::set_difference(
newKeys.begin(), newKeys.end(), oldKeys.begin(), oldKeys.end(), std::inserter(pressed, pressed.end()),
ButtonToKeyLess()
);
std::ranges::set_difference(oldKeys, newKeys, std::inserter(released, released.end()), ButtonToKeyLess());
std::ranges::set_difference(newKeys, oldKeys, std::inserter(pressed, pressed.end()), ButtonToKeyLess());
// update state
for (deskflow::KeyMap::ButtonToKeyMap::const_iterator i = released.begin(); i != released.end(); ++i) {