Prefer try_emplace over emplace for maps

This commit is contained in:
Lukas Dürrenberger 2024-09-26 21:49:30 +02:00 committed by Chris Thrasher
parent eb4a2dbe0f
commit 053ef0b483
5 changed files with 162 additions and 161 deletions

View File

@ -102,7 +102,7 @@ int main()
// Set up our joystick identification sf::Text objects
{
auto [it, success] = texts.emplace("ID", JoystickObject{{font, "<Not Connected>"}, {font}});
auto [it, success] = texts.try_emplace("ID", JoystickObject{{font, "<Not Connected>"}, {font}});
auto& [label, value] = it->second;
label.setPosition({5.f, 5.f});
value.setPosition({80.f, 5.f});
@ -112,7 +112,7 @@ int main()
sstr.str("");
sstr << threshold << " (Change with up/down arrow keys)";
{
auto [it, success] = texts.emplace("Threshold", JoystickObject{{font, "Threshold:"}, {font, sstr.str()}});
auto [it, success] = texts.try_emplace("Threshold", JoystickObject{{font, "Threshold:"}, {font, sstr.str()}});
auto& [label, value] = it->second;
label.setPosition({5.f, 5.f + 2 * font.getLineSpacing(14)});
value.setPosition({80.f, 5.f + 2 * font.getLineSpacing(14)});
@ -121,7 +121,8 @@ int main()
// Set up our label-value sf::Text objects
for (unsigned int i = 0; i < sf::Joystick::AxisCount; ++i)
{
auto [it, success] = texts.emplace(axislabels[i], JoystickObject{{font, axislabels[i] + ":"}, {font, "N/A"}});
auto [it,
success] = texts.try_emplace(axislabels[i], JoystickObject{{font, axislabels[i] + ":"}, {font, "N/A"}});
auto& [label, value] = it->second;
label.setPosition({5.f, 5.f + (static_cast<float>(i + 4) * font.getLineSpacing(14))});
value.setPosition({80.f, 5.f + (static_cast<float>(i + 4) * font.getLineSpacing(14))});
@ -131,7 +132,7 @@ int main()
{
sstr.str("");
sstr << "Button " << i;
auto [it, success] = texts.emplace(sstr.str(), JoystickObject{{font, sstr.str() + ":"}, {font, "N/A"}});
auto [it, success] = texts.try_emplace(sstr.str(), JoystickObject{{font, sstr.str() + ":"}, {font, "N/A"}});
auto& [label, value] = it->second;
label.setPosition({5.f, 5.f + (static_cast<float>(sf::Joystick::AxisCount + i + 4) * font.getLineSpacing(14))});
value.setPosition({80.f, 5.f + (static_cast<float>(sf::Joystick::AxisCount + i + 4) * font.getLineSpacing(14))});

View File

@ -357,7 +357,7 @@ const Glyph& Font::getGlyph(std::uint32_t codePoint, unsigned int characterSize,
// Not found: we have to load it
const Glyph glyph = loadGlyph(codePoint, characterSize, bold, outlineThickness);
return glyphs.emplace(key, glyph).first->second;
return glyphs.try_emplace(key, glyph).first->second;
}

View File

@ -438,7 +438,7 @@ bool RenderTextureImplFBO::createFrameBuffer()
}
// Insert the FBO into our map
m_frameBuffers.emplace(Context::getActiveContextId(), frameBuffer);
m_frameBuffers.try_emplace(Context::getActiveContextId(), frameBuffer);
// Register the object with the current context so it is automatically destroyed
registerUnsharedGlObject(std::move(frameBuffer));
@ -494,7 +494,7 @@ bool RenderTextureImplFBO::createFrameBuffer()
}
// Insert the FBO into our map
m_multisampleFrameBuffers.emplace(Context::getActiveContextId(), multisampleFrameBuffer);
m_multisampleFrameBuffers.try_emplace(Context::getActiveContextId(), multisampleFrameBuffer);
// Register the object with the current context so it is automatically destroyed
registerUnsharedGlObject(std::move(multisampleFrameBuffer));

View File

@ -980,7 +980,7 @@ int Shader::getUniformLocation(const std::string& name)
// Not in cache, request the location from OpenGL
const int location = GLEXT_glGetUniformLocation(castToGlHandle(m_shaderProgram), name.c_str());
m_uniforms.emplace(name, location);
m_uniforms.try_emplace(name, location);
if (location == -1)
err() << "Uniform " << std::quoted(name) << " not found in shader" << std::endl;

View File

@ -283,172 +283,172 @@ std::unordered_map<std::string, sf::Keyboard::Scancode> getNameScancodeMap()
{
std::unordered_map<std::string, sf::Keyboard::Scancode> mapping;
mapping.emplace("LSGT", sf::Keyboard::Scan::NonUsBackslash);
mapping.try_emplace("LSGT", sf::Keyboard::Scan::NonUsBackslash);
mapping.emplace("TLDE", sf::Keyboard::Scan::Grave);
mapping.emplace("AE01", sf::Keyboard::Scan::Num1);
mapping.emplace("AE02", sf::Keyboard::Scan::Num2);
mapping.emplace("AE03", sf::Keyboard::Scan::Num3);
mapping.emplace("AE04", sf::Keyboard::Scan::Num4);
mapping.emplace("AE05", sf::Keyboard::Scan::Num5);
mapping.emplace("AE06", sf::Keyboard::Scan::Num6);
mapping.emplace("AE07", sf::Keyboard::Scan::Num7);
mapping.emplace("AE08", sf::Keyboard::Scan::Num8);
mapping.emplace("AE09", sf::Keyboard::Scan::Num9);
mapping.emplace("AE10", sf::Keyboard::Scan::Num0);
mapping.emplace("AE11", sf::Keyboard::Scan::Hyphen);
mapping.emplace("AE12", sf::Keyboard::Scan::Equal);
mapping.emplace("BKSP", sf::Keyboard::Scan::Backspace);
mapping.emplace("TAB", sf::Keyboard::Scan::Tab);
mapping.emplace("AD01", sf::Keyboard::Scan::Q);
mapping.emplace("AD02", sf::Keyboard::Scan::W);
mapping.emplace("AD03", sf::Keyboard::Scan::E);
mapping.emplace("AD04", sf::Keyboard::Scan::R);
mapping.emplace("AD05", sf::Keyboard::Scan::T);
mapping.emplace("AD06", sf::Keyboard::Scan::Y);
mapping.emplace("AD07", sf::Keyboard::Scan::U);
mapping.emplace("AD08", sf::Keyboard::Scan::I);
mapping.emplace("AD09", sf::Keyboard::Scan::O);
mapping.emplace("AD10", sf::Keyboard::Scan::P);
mapping.emplace("AD11", sf::Keyboard::Scan::LBracket);
mapping.emplace("AD12", sf::Keyboard::Scan::RBracket);
mapping.emplace("BKSL", sf::Keyboard::Scan::Backslash);
mapping.emplace("RTRN", sf::Keyboard::Scan::Enter);
mapping.try_emplace("TLDE", sf::Keyboard::Scan::Grave);
mapping.try_emplace("AE01", sf::Keyboard::Scan::Num1);
mapping.try_emplace("AE02", sf::Keyboard::Scan::Num2);
mapping.try_emplace("AE03", sf::Keyboard::Scan::Num3);
mapping.try_emplace("AE04", sf::Keyboard::Scan::Num4);
mapping.try_emplace("AE05", sf::Keyboard::Scan::Num5);
mapping.try_emplace("AE06", sf::Keyboard::Scan::Num6);
mapping.try_emplace("AE07", sf::Keyboard::Scan::Num7);
mapping.try_emplace("AE08", sf::Keyboard::Scan::Num8);
mapping.try_emplace("AE09", sf::Keyboard::Scan::Num9);
mapping.try_emplace("AE10", sf::Keyboard::Scan::Num0);
mapping.try_emplace("AE11", sf::Keyboard::Scan::Hyphen);
mapping.try_emplace("AE12", sf::Keyboard::Scan::Equal);
mapping.try_emplace("BKSP", sf::Keyboard::Scan::Backspace);
mapping.try_emplace("TAB", sf::Keyboard::Scan::Tab);
mapping.try_emplace("AD01", sf::Keyboard::Scan::Q);
mapping.try_emplace("AD02", sf::Keyboard::Scan::W);
mapping.try_emplace("AD03", sf::Keyboard::Scan::E);
mapping.try_emplace("AD04", sf::Keyboard::Scan::R);
mapping.try_emplace("AD05", sf::Keyboard::Scan::T);
mapping.try_emplace("AD06", sf::Keyboard::Scan::Y);
mapping.try_emplace("AD07", sf::Keyboard::Scan::U);
mapping.try_emplace("AD08", sf::Keyboard::Scan::I);
mapping.try_emplace("AD09", sf::Keyboard::Scan::O);
mapping.try_emplace("AD10", sf::Keyboard::Scan::P);
mapping.try_emplace("AD11", sf::Keyboard::Scan::LBracket);
mapping.try_emplace("AD12", sf::Keyboard::Scan::RBracket);
mapping.try_emplace("BKSL", sf::Keyboard::Scan::Backslash);
mapping.try_emplace("RTRN", sf::Keyboard::Scan::Enter);
mapping.emplace("CAPS", sf::Keyboard::Scan::CapsLock);
mapping.emplace("AC01", sf::Keyboard::Scan::A);
mapping.emplace("AC02", sf::Keyboard::Scan::S);
mapping.emplace("AC03", sf::Keyboard::Scan::D);
mapping.emplace("AC04", sf::Keyboard::Scan::F);
mapping.emplace("AC05", sf::Keyboard::Scan::G);
mapping.emplace("AC06", sf::Keyboard::Scan::H);
mapping.emplace("AC07", sf::Keyboard::Scan::J);
mapping.emplace("AC08", sf::Keyboard::Scan::K);
mapping.emplace("AC09", sf::Keyboard::Scan::L);
mapping.emplace("AC10", sf::Keyboard::Scan::Semicolon);
mapping.emplace("AC11", sf::Keyboard::Scan::Apostrophe);
mapping.emplace("AC12", sf::Keyboard::Scan::Backslash);
mapping.try_emplace("CAPS", sf::Keyboard::Scan::CapsLock);
mapping.try_emplace("AC01", sf::Keyboard::Scan::A);
mapping.try_emplace("AC02", sf::Keyboard::Scan::S);
mapping.try_emplace("AC03", sf::Keyboard::Scan::D);
mapping.try_emplace("AC04", sf::Keyboard::Scan::F);
mapping.try_emplace("AC05", sf::Keyboard::Scan::G);
mapping.try_emplace("AC06", sf::Keyboard::Scan::H);
mapping.try_emplace("AC07", sf::Keyboard::Scan::J);
mapping.try_emplace("AC08", sf::Keyboard::Scan::K);
mapping.try_emplace("AC09", sf::Keyboard::Scan::L);
mapping.try_emplace("AC10", sf::Keyboard::Scan::Semicolon);
mapping.try_emplace("AC11", sf::Keyboard::Scan::Apostrophe);
mapping.try_emplace("AC12", sf::Keyboard::Scan::Backslash);
mapping.emplace("LFSH", sf::Keyboard::Scan::LShift);
mapping.emplace("AB01", sf::Keyboard::Scan::Z);
mapping.emplace("AB02", sf::Keyboard::Scan::X);
mapping.emplace("AB03", sf::Keyboard::Scan::C);
mapping.emplace("AB04", sf::Keyboard::Scan::V);
mapping.emplace("AB05", sf::Keyboard::Scan::B);
mapping.emplace("AB06", sf::Keyboard::Scan::N);
mapping.emplace("AB07", sf::Keyboard::Scan::M);
mapping.emplace("AB08", sf::Keyboard::Scan::Comma);
mapping.emplace("AB09", sf::Keyboard::Scan::Period);
mapping.emplace("AB10", sf::Keyboard::Scan::Slash);
mapping.emplace("RTSH", sf::Keyboard::Scan::RShift);
mapping.try_emplace("LFSH", sf::Keyboard::Scan::LShift);
mapping.try_emplace("AB01", sf::Keyboard::Scan::Z);
mapping.try_emplace("AB02", sf::Keyboard::Scan::X);
mapping.try_emplace("AB03", sf::Keyboard::Scan::C);
mapping.try_emplace("AB04", sf::Keyboard::Scan::V);
mapping.try_emplace("AB05", sf::Keyboard::Scan::B);
mapping.try_emplace("AB06", sf::Keyboard::Scan::N);
mapping.try_emplace("AB07", sf::Keyboard::Scan::M);
mapping.try_emplace("AB08", sf::Keyboard::Scan::Comma);
mapping.try_emplace("AB09", sf::Keyboard::Scan::Period);
mapping.try_emplace("AB10", sf::Keyboard::Scan::Slash);
mapping.try_emplace("RTSH", sf::Keyboard::Scan::RShift);
mapping.emplace("LCTL", sf::Keyboard::Scan::LControl);
mapping.emplace("LALT", sf::Keyboard::Scan::LAlt);
mapping.emplace("SPCE", sf::Keyboard::Scan::Space);
mapping.emplace("RCTL", sf::Keyboard::Scan::RControl);
mapping.emplace("RALT", sf::Keyboard::Scan::RAlt);
mapping.emplace("LVL3", sf::Keyboard::Scan::RAlt);
mapping.emplace("ALGR", sf::Keyboard::Scan::RAlt);
mapping.emplace("LWIN", sf::Keyboard::Scan::LSystem);
mapping.emplace("RWIN", sf::Keyboard::Scan::RSystem);
mapping.try_emplace("LCTL", sf::Keyboard::Scan::LControl);
mapping.try_emplace("LALT", sf::Keyboard::Scan::LAlt);
mapping.try_emplace("SPCE", sf::Keyboard::Scan::Space);
mapping.try_emplace("RCTL", sf::Keyboard::Scan::RControl);
mapping.try_emplace("RALT", sf::Keyboard::Scan::RAlt);
mapping.try_emplace("LVL3", sf::Keyboard::Scan::RAlt);
mapping.try_emplace("ALGR", sf::Keyboard::Scan::RAlt);
mapping.try_emplace("LWIN", sf::Keyboard::Scan::LSystem);
mapping.try_emplace("RWIN", sf::Keyboard::Scan::RSystem);
mapping.emplace("HYPR", sf::Keyboard::Scan::Application);
mapping.emplace("EXEC", sf::Keyboard::Scan::Execute);
mapping.emplace("MDSW", sf::Keyboard::Scan::ModeChange);
mapping.emplace("MENU", sf::Keyboard::Scan::Menu);
mapping.emplace("COMP", sf::Keyboard::Scan::Menu);
mapping.emplace("SELE", sf::Keyboard::Scan::Select);
mapping.try_emplace("HYPR", sf::Keyboard::Scan::Application);
mapping.try_emplace("EXEC", sf::Keyboard::Scan::Execute);
mapping.try_emplace("MDSW", sf::Keyboard::Scan::ModeChange);
mapping.try_emplace("MENU", sf::Keyboard::Scan::Menu);
mapping.try_emplace("COMP", sf::Keyboard::Scan::Menu);
mapping.try_emplace("SELE", sf::Keyboard::Scan::Select);
mapping.emplace("ESC", sf::Keyboard::Scan::Escape);
mapping.emplace("FK01", sf::Keyboard::Scan::F1);
mapping.emplace("FK02", sf::Keyboard::Scan::F2);
mapping.emplace("FK03", sf::Keyboard::Scan::F3);
mapping.emplace("FK04", sf::Keyboard::Scan::F4);
mapping.emplace("FK05", sf::Keyboard::Scan::F5);
mapping.emplace("FK06", sf::Keyboard::Scan::F6);
mapping.emplace("FK07", sf::Keyboard::Scan::F7);
mapping.emplace("FK08", sf::Keyboard::Scan::F8);
mapping.emplace("FK09", sf::Keyboard::Scan::F9);
mapping.emplace("FK10", sf::Keyboard::Scan::F10);
mapping.emplace("FK11", sf::Keyboard::Scan::F11);
mapping.emplace("FK12", sf::Keyboard::Scan::F12);
mapping.try_emplace("ESC", sf::Keyboard::Scan::Escape);
mapping.try_emplace("FK01", sf::Keyboard::Scan::F1);
mapping.try_emplace("FK02", sf::Keyboard::Scan::F2);
mapping.try_emplace("FK03", sf::Keyboard::Scan::F3);
mapping.try_emplace("FK04", sf::Keyboard::Scan::F4);
mapping.try_emplace("FK05", sf::Keyboard::Scan::F5);
mapping.try_emplace("FK06", sf::Keyboard::Scan::F6);
mapping.try_emplace("FK07", sf::Keyboard::Scan::F7);
mapping.try_emplace("FK08", sf::Keyboard::Scan::F8);
mapping.try_emplace("FK09", sf::Keyboard::Scan::F9);
mapping.try_emplace("FK10", sf::Keyboard::Scan::F10);
mapping.try_emplace("FK11", sf::Keyboard::Scan::F11);
mapping.try_emplace("FK12", sf::Keyboard::Scan::F12);
mapping.emplace("PRSC", sf::Keyboard::Scan::PrintScreen);
mapping.emplace("SCLK", sf::Keyboard::Scan::ScrollLock);
mapping.emplace("PAUS", sf::Keyboard::Scan::Pause);
mapping.try_emplace("PRSC", sf::Keyboard::Scan::PrintScreen);
mapping.try_emplace("SCLK", sf::Keyboard::Scan::ScrollLock);
mapping.try_emplace("PAUS", sf::Keyboard::Scan::Pause);
mapping.emplace("INS", sf::Keyboard::Scan::Insert);
mapping.emplace("HOME", sf::Keyboard::Scan::Home);
mapping.emplace("PGUP", sf::Keyboard::Scan::PageUp);
mapping.emplace("DELE", sf::Keyboard::Scan::Delete);
mapping.emplace("END", sf::Keyboard::Scan::End);
mapping.emplace("PGDN", sf::Keyboard::Scan::PageDown);
mapping.try_emplace("INS", sf::Keyboard::Scan::Insert);
mapping.try_emplace("HOME", sf::Keyboard::Scan::Home);
mapping.try_emplace("PGUP", sf::Keyboard::Scan::PageUp);
mapping.try_emplace("DELE", sf::Keyboard::Scan::Delete);
mapping.try_emplace("END", sf::Keyboard::Scan::End);
mapping.try_emplace("PGDN", sf::Keyboard::Scan::PageDown);
mapping.emplace("UP", sf::Keyboard::Scan::Up);
mapping.emplace("RGHT", sf::Keyboard::Scan::Right);
mapping.emplace("DOWN", sf::Keyboard::Scan::Down);
mapping.emplace("LEFT", sf::Keyboard::Scan::Left);
mapping.try_emplace("UP", sf::Keyboard::Scan::Up);
mapping.try_emplace("RGHT", sf::Keyboard::Scan::Right);
mapping.try_emplace("DOWN", sf::Keyboard::Scan::Down);
mapping.try_emplace("LEFT", sf::Keyboard::Scan::Left);
mapping.emplace("NMLK", sf::Keyboard::Scan::NumLock);
mapping.emplace("KPDV", sf::Keyboard::Scan::NumpadDivide);
mapping.emplace("KPMU", sf::Keyboard::Scan::NumpadMultiply);
mapping.emplace("KPSU", sf::Keyboard::Scan::NumpadMinus);
mapping.try_emplace("NMLK", sf::Keyboard::Scan::NumLock);
mapping.try_emplace("KPDV", sf::Keyboard::Scan::NumpadDivide);
mapping.try_emplace("KPMU", sf::Keyboard::Scan::NumpadMultiply);
mapping.try_emplace("KPSU", sf::Keyboard::Scan::NumpadMinus);
mapping.emplace("KP7", sf::Keyboard::Scan::Numpad7);
mapping.emplace("KP8", sf::Keyboard::Scan::Numpad8);
mapping.emplace("KP9", sf::Keyboard::Scan::Numpad9);
mapping.emplace("KPAD", sf::Keyboard::Scan::NumpadPlus);
mapping.emplace("KP4", sf::Keyboard::Scan::Numpad4);
mapping.emplace("KP5", sf::Keyboard::Scan::Numpad5);
mapping.emplace("KP6", sf::Keyboard::Scan::Numpad6);
mapping.emplace("KP1", sf::Keyboard::Scan::Numpad1);
mapping.emplace("KP2", sf::Keyboard::Scan::Numpad2);
mapping.emplace("KP3", sf::Keyboard::Scan::Numpad3);
mapping.emplace("KPEN", sf::Keyboard::Scan::NumpadEnter);
mapping.emplace("KP0", sf::Keyboard::Scan::Numpad0);
mapping.emplace("KPDL", sf::Keyboard::Scan::NumpadDecimal);
mapping.emplace("KPEQ", sf::Keyboard::Scan::NumpadEqual);
mapping.try_emplace("KP7", sf::Keyboard::Scan::Numpad7);
mapping.try_emplace("KP8", sf::Keyboard::Scan::Numpad8);
mapping.try_emplace("KP9", sf::Keyboard::Scan::Numpad9);
mapping.try_emplace("KPAD", sf::Keyboard::Scan::NumpadPlus);
mapping.try_emplace("KP4", sf::Keyboard::Scan::Numpad4);
mapping.try_emplace("KP5", sf::Keyboard::Scan::Numpad5);
mapping.try_emplace("KP6", sf::Keyboard::Scan::Numpad6);
mapping.try_emplace("KP1", sf::Keyboard::Scan::Numpad1);
mapping.try_emplace("KP2", sf::Keyboard::Scan::Numpad2);
mapping.try_emplace("KP3", sf::Keyboard::Scan::Numpad3);
mapping.try_emplace("KPEN", sf::Keyboard::Scan::NumpadEnter);
mapping.try_emplace("KP0", sf::Keyboard::Scan::Numpad0);
mapping.try_emplace("KPDL", sf::Keyboard::Scan::NumpadDecimal);
mapping.try_emplace("KPEQ", sf::Keyboard::Scan::NumpadEqual);
mapping.emplace("FK13", sf::Keyboard::Scan::F13);
mapping.emplace("FK14", sf::Keyboard::Scan::F14);
mapping.emplace("FK15", sf::Keyboard::Scan::F15);
mapping.emplace("FK16", sf::Keyboard::Scan::F16);
mapping.emplace("FK17", sf::Keyboard::Scan::F17);
mapping.emplace("FK18", sf::Keyboard::Scan::F18);
mapping.emplace("FK19", sf::Keyboard::Scan::F19);
mapping.emplace("FK20", sf::Keyboard::Scan::F20);
mapping.emplace("FK21", sf::Keyboard::Scan::F21);
mapping.emplace("FK22", sf::Keyboard::Scan::F22);
mapping.emplace("FK23", sf::Keyboard::Scan::F23);
mapping.emplace("FK24", sf::Keyboard::Scan::F24);
mapping.emplace("LMTA", sf::Keyboard::Scan::LSystem);
mapping.emplace("RMTA", sf::Keyboard::Scan::RSystem);
mapping.emplace("MUTE", sf::Keyboard::Scan::VolumeMute);
mapping.emplace("VOL-", sf::Keyboard::Scan::VolumeDown);
mapping.emplace("VOL+", sf::Keyboard::Scan::VolumeUp);
mapping.emplace("STOP", sf::Keyboard::Scan::Stop);
mapping.emplace("REDO", sf::Keyboard::Scan::Redo);
mapping.emplace("AGAI", sf::Keyboard::Scan::Redo);
mapping.emplace("UNDO", sf::Keyboard::Scan::Undo);
mapping.emplace("COPY", sf::Keyboard::Scan::Copy);
mapping.emplace("PAST", sf::Keyboard::Scan::Paste);
mapping.emplace("FIND", sf::Keyboard::Scan::Search);
mapping.emplace("CUT", sf::Keyboard::Scan::Cut);
mapping.emplace("HELP", sf::Keyboard::Scan::Help);
mapping.try_emplace("FK13", sf::Keyboard::Scan::F13);
mapping.try_emplace("FK14", sf::Keyboard::Scan::F14);
mapping.try_emplace("FK15", sf::Keyboard::Scan::F15);
mapping.try_emplace("FK16", sf::Keyboard::Scan::F16);
mapping.try_emplace("FK17", sf::Keyboard::Scan::F17);
mapping.try_emplace("FK18", sf::Keyboard::Scan::F18);
mapping.try_emplace("FK19", sf::Keyboard::Scan::F19);
mapping.try_emplace("FK20", sf::Keyboard::Scan::F20);
mapping.try_emplace("FK21", sf::Keyboard::Scan::F21);
mapping.try_emplace("FK22", sf::Keyboard::Scan::F22);
mapping.try_emplace("FK23", sf::Keyboard::Scan::F23);
mapping.try_emplace("FK24", sf::Keyboard::Scan::F24);
mapping.try_emplace("LMTA", sf::Keyboard::Scan::LSystem);
mapping.try_emplace("RMTA", sf::Keyboard::Scan::RSystem);
mapping.try_emplace("MUTE", sf::Keyboard::Scan::VolumeMute);
mapping.try_emplace("VOL-", sf::Keyboard::Scan::VolumeDown);
mapping.try_emplace("VOL+", sf::Keyboard::Scan::VolumeUp);
mapping.try_emplace("STOP", sf::Keyboard::Scan::Stop);
mapping.try_emplace("REDO", sf::Keyboard::Scan::Redo);
mapping.try_emplace("AGAI", sf::Keyboard::Scan::Redo);
mapping.try_emplace("UNDO", sf::Keyboard::Scan::Undo);
mapping.try_emplace("COPY", sf::Keyboard::Scan::Copy);
mapping.try_emplace("PAST", sf::Keyboard::Scan::Paste);
mapping.try_emplace("FIND", sf::Keyboard::Scan::Search);
mapping.try_emplace("CUT", sf::Keyboard::Scan::Cut);
mapping.try_emplace("HELP", sf::Keyboard::Scan::Help);
mapping.emplace("I156", sf::Keyboard::Scan::LaunchApplication1);
mapping.emplace("I157", sf::Keyboard::Scan::LaunchApplication2);
mapping.emplace("I164", sf::Keyboard::Scan::Favorites);
mapping.emplace("I166", sf::Keyboard::Scan::Back);
mapping.emplace("I167", sf::Keyboard::Scan::Forward);
mapping.emplace("I171", sf::Keyboard::Scan::MediaNextTrack);
mapping.emplace("I172", sf::Keyboard::Scan::MediaPlayPause);
mapping.emplace("I173", sf::Keyboard::Scan::MediaPreviousTrack);
mapping.emplace("I174", sf::Keyboard::Scan::MediaStop);
mapping.emplace("I180", sf::Keyboard::Scan::HomePage);
mapping.emplace("I181", sf::Keyboard::Scan::Refresh);
mapping.emplace("I223", sf::Keyboard::Scan::LaunchMail);
mapping.emplace("I234", sf::Keyboard::Scan::LaunchMediaSelect);
mapping.try_emplace("I156", sf::Keyboard::Scan::LaunchApplication1);
mapping.try_emplace("I157", sf::Keyboard::Scan::LaunchApplication2);
mapping.try_emplace("I164", sf::Keyboard::Scan::Favorites);
mapping.try_emplace("I166", sf::Keyboard::Scan::Back);
mapping.try_emplace("I167", sf::Keyboard::Scan::Forward);
mapping.try_emplace("I171", sf::Keyboard::Scan::MediaNextTrack);
mapping.try_emplace("I172", sf::Keyboard::Scan::MediaPlayPause);
mapping.try_emplace("I173", sf::Keyboard::Scan::MediaPreviousTrack);
mapping.try_emplace("I174", sf::Keyboard::Scan::MediaStop);
mapping.try_emplace("I180", sf::Keyboard::Scan::HomePage);
mapping.try_emplace("I181", sf::Keyboard::Scan::Refresh);
mapping.try_emplace("I223", sf::Keyboard::Scan::LaunchMail);
mapping.try_emplace("I234", sf::Keyboard::Scan::LaunchMediaSelect);
return mapping;
}