From 27a82e733be521706f1fe563765fff852f54549c Mon Sep 17 00:00:00 2001 From: CosminPerRam Date: Wed, 4 May 2022 01:46:00 +0300 Subject: [PATCH] try_emplace in Font::loadPage --- src/SFML/Graphics/Font.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/SFML/Graphics/Font.cpp b/src/SFML/Graphics/Font.cpp index 08a73cdc..7b952759 100644 --- a/src/SFML/Graphics/Font.cpp +++ b/src/SFML/Graphics/Font.cpp @@ -534,12 +534,7 @@ void Font::cleanup() //////////////////////////////////////////////////////////// Font::Page& Font::loadPage(unsigned int characterSize) const { - // TODO: Remove this method and use try_emplace instead when updating to C++17 - PageTable::iterator pageIterator = m_pages.find(characterSize); - if (pageIterator == m_pages.end()) - pageIterator = m_pages.insert(std::make_pair(characterSize, Page(m_isSmooth))).first; - - return pageIterator->second; + return m_pages.try_emplace(characterSize, Page(m_isSmooth)).first->second; }