Using reserve() for optimization inserts, marked unused pair items and minor code refactor

This commit is contained in:
Herman Semenov
2024-04-12 15:42:47 +03:00
committed by chaphidoesstuff
parent 9490b5264e
commit e886f27816
27 changed files with 43 additions and 32 deletions

View File

@@ -571,7 +571,7 @@ SDLDriver::~SDLDriver() {
std::vector<Common::ParamPackage> SDLDriver::GetInputDevices() const {
std::vector<Common::ParamPackage> devices;
std::unordered_map<int, std::shared_ptr<SDLJoystick>> joycon_pairs;
for (const auto& [key, value] : joystick_map) {
for (const auto& [_, value] : joystick_map) {
for (const auto& joystick : value) {
if (!joystick->GetSDLJoystick()) {
continue;
@@ -591,7 +591,7 @@ std::vector<Common::ParamPackage> SDLDriver::GetInputDevices() const {
}
// Add dual controllers
for (const auto& [key, value] : joystick_map) {
for (const auto& [_, value] : joystick_map) {
for (const auto& joystick : value) {
if (joystick->IsJoyconRight()) {
if (!joycon_pairs.contains(joystick->GetPort())) {