diff --git a/examples/joystick/Joystick.cpp b/examples/joystick/Joystick.cpp index d3a635ffa..7d3557a9a 100644 --- a/examples/joystick/Joystick.cpp +++ b/examples/joystick/Joystick.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include namespace @@ -18,7 +18,7 @@ namespace sf::Text value; }; - typedef std::map Texts; + typedef std::unordered_map Texts; Texts texts; std::ostringstream sstr; float threshold = 0.1f; diff --git a/include/SFML/Audio/SoundBuffer.hpp b/include/SFML/Audio/SoundBuffer.hpp index a8f583a0b..7f2200974 100644 --- a/include/SFML/Audio/SoundBuffer.hpp +++ b/include/SFML/Audio/SoundBuffer.hpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include namespace sf @@ -267,7 +267,7 @@ private: //////////////////////////////////////////////////////////// // Types //////////////////////////////////////////////////////////// - typedef std::set SoundList; //!< Set of unique sound instances + typedef std::unordered_set SoundList; //!< Set of unique sound instances //////////////////////////////////////////////////////////// // Member data diff --git a/include/SFML/Graphics/Font.hpp b/include/SFML/Graphics/Font.hpp index 8d47ae8c1..9e4aadeca 100644 --- a/include/SFML/Graphics/Font.hpp +++ b/include/SFML/Graphics/Font.hpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include @@ -327,7 +327,7 @@ private: //////////////////////////////////////////////////////////// // Types //////////////////////////////////////////////////////////// - typedef std::map GlyphTable; //!< Table mapping a codepoint to its glyph + typedef std::unordered_map GlyphTable; //!< Table mapping a codepoint to its glyph //////////////////////////////////////////////////////////// /// \brief Structure defining a page of glyphs @@ -387,7 +387,7 @@ private: //////////////////////////////////////////////////////////// // Types //////////////////////////////////////////////////////////// - typedef std::map PageTable; //!< Table mapping a character size to its page (texture) + typedef std::unordered_map PageTable; //!< Table mapping a character size to its page (texture) //////////////////////////////////////////////////////////// // Member data diff --git a/include/SFML/Graphics/Shader.hpp b/include/SFML/Graphics/Shader.hpp index f3d99760e..cb2fb9f2e 100644 --- a/include/SFML/Graphics/Shader.hpp +++ b/include/SFML/Graphics/Shader.hpp @@ -34,8 +34,8 @@ #include #include #include -#include #include +#include namespace sf @@ -739,8 +739,8 @@ private: //////////////////////////////////////////////////////////// // Types //////////////////////////////////////////////////////////// - typedef std::map TextureTable; - typedef std::map UniformTable; + typedef std::unordered_map TextureTable; + typedef std::unordered_map UniformTable; //////////////////////////////////////////////////////////// // Member data diff --git a/include/SFML/Network/Http.hpp b/include/SFML/Network/Http.hpp index a2c7d5646..ab2c67726 100644 --- a/include/SFML/Network/Http.hpp +++ b/include/SFML/Network/Http.hpp @@ -173,7 +173,7 @@ public: //////////////////////////////////////////////////////////// // Types //////////////////////////////////////////////////////////// - typedef std::map FieldTable; + typedef std::map FieldTable; // Use an ordered map for predictable payloads //////////////////////////////////////////////////////////// // Member data @@ -333,7 +333,7 @@ public: //////////////////////////////////////////////////////////// // Types //////////////////////////////////////////////////////////// - typedef std::map FieldTable; + typedef std::map FieldTable; // Use an ordered map for predictable payloads //////////////////////////////////////////////////////////// // Member data diff --git a/src/SFML/Graphics/RenderTarget.cpp b/src/SFML/Graphics/RenderTarget.cpp index 586039a1d..dc4dd11d6 100644 --- a/src/SFML/Graphics/RenderTarget.cpp +++ b/src/SFML/Graphics/RenderTarget.cpp @@ -39,7 +39,7 @@ #include #include #include -#include +#include // GL_QUADS is unavailable on OpenGL ES, thus we need to define GL_QUADS ourselves @@ -71,7 +71,7 @@ namespace // Map to help us detect whether a different RenderTarget // has been activated within a single context - typedef std::map ContextRenderTargetMap; + typedef std::unordered_map ContextRenderTargetMap; ContextRenderTargetMap contextRenderTargetMap; // Check if a RenderTarget with the given ID is active in the current context diff --git a/src/SFML/Graphics/RenderTextureImplFBO.cpp b/src/SFML/Graphics/RenderTextureImplFBO.cpp index e373974af..ee6edcc2d 100644 --- a/src/SFML/Graphics/RenderTextureImplFBO.cpp +++ b/src/SFML/Graphics/RenderTextureImplFBO.cpp @@ -32,6 +32,8 @@ #include #include #include +#include +#include #include @@ -40,7 +42,7 @@ namespace // Set to track all active FBO mappings // This is used to free active FBOs while their owning // RenderTextureImplFBO is still alive - std::set*> frameBuffers; + std::unordered_set*> frameBuffers; // Set to track all stale FBOs // This is used to free stale FBOs after their owning @@ -84,9 +86,9 @@ namespace sf::Uint64 contextId = sf::Context::getActiveContextId(); // Destroy active frame buffer objects - for (std::set*>::iterator frameBuffersIter = frameBuffers.begin(); frameBuffersIter != frameBuffers.end(); ++frameBuffersIter) + for (std::unordered_set*>::iterator frameBuffersIter = frameBuffers.begin(); frameBuffersIter != frameBuffers.end(); ++frameBuffersIter) { - for (std::map::iterator iter = (*frameBuffersIter)->begin(); iter != (*frameBuffersIter)->end(); ++iter) + for (std::unordered_map::iterator iter = (*frameBuffersIter)->begin(); iter != (*frameBuffersIter)->end(); ++iter) { if (iter->first == contextId) { @@ -160,10 +162,10 @@ RenderTextureImplFBO::~RenderTextureImplFBO() } // Move all frame buffer objects to stale set - for (std::map::iterator iter = m_frameBuffers.begin(); iter != m_frameBuffers.end(); ++iter) + for (std::unordered_map::iterator iter = m_frameBuffers.begin(); iter != m_frameBuffers.end(); ++iter) staleFrameBuffers.emplace(iter->first, iter->second); - for (std::map::iterator iter = m_multisampleFrameBuffers.begin(); iter != m_multisampleFrameBuffers.end(); ++iter) + for (std::unordered_map::iterator iter = m_multisampleFrameBuffers.begin(); iter != m_multisampleFrameBuffers.end(); ++iter) staleFrameBuffers.emplace(iter->first, iter->second); // Clean up FBOs @@ -540,7 +542,7 @@ bool RenderTextureImplFBO::activate(bool active) { Lock lock(mutex); - std::map::iterator iter; + std::unordered_map::iterator iter; if (m_multisample) { @@ -594,8 +596,8 @@ void RenderTextureImplFBO::updateTexture(unsigned int) Lock lock(mutex); - std::map::iterator iter = m_frameBuffers.find(contextId); - std::map::iterator multisampleIter = m_multisampleFrameBuffers.find(contextId); + std::unordered_map::iterator iter = m_frameBuffers.find(contextId); + std::unordered_map::iterator multisampleIter = m_multisampleFrameBuffers.find(contextId); if ((iter != m_frameBuffers.end()) && (multisampleIter != m_multisampleFrameBuffers.end())) { diff --git a/src/SFML/Graphics/RenderTextureImplFBO.hpp b/src/SFML/Graphics/RenderTextureImplFBO.hpp index 14ebe8e7b..90465803a 100644 --- a/src/SFML/Graphics/RenderTextureImplFBO.hpp +++ b/src/SFML/Graphics/RenderTextureImplFBO.hpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include namespace sf @@ -136,17 +136,17 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - std::map m_frameBuffers; //!< OpenGL frame buffer objects per context - std::map m_multisampleFrameBuffers; //!< Optional per-context OpenGL frame buffer objects with multisample attachments - unsigned int m_depthStencilBuffer; //!< Optional depth/stencil buffer attached to the frame buffer - unsigned int m_colorBuffer; //!< Optional multisample color buffer attached to the frame buffer - unsigned int m_width; //!< Width of the attachments - unsigned int m_height; //!< Height of the attachments - Context* m_context; //!< Backup OpenGL context, used when none already exist - unsigned int m_textureId; //!< The ID of the texture to attach to the FBO - bool m_multisample; //!< Whether we have to create a multisample frame buffer as well - bool m_stencil; //!< Whether we have stencil attachment - bool m_sRgb; //!< Whether we need to encode drawn pixels into sRGB color space + std::unordered_map m_frameBuffers; //!< OpenGL frame buffer objects per context + std::unordered_map m_multisampleFrameBuffers; //!< Optional per-context OpenGL frame buffer objects with multisample attachments + unsigned int m_depthStencilBuffer; //!< Optional depth/stencil buffer attached to the frame buffer + unsigned int m_colorBuffer; //!< Optional multisample color buffer attached to the frame buffer + unsigned int m_width; //!< Width of the attachments + unsigned int m_height; //!< Height of the attachments + Context* m_context; //!< Backup OpenGL context, used when none already exist + unsigned int m_textureId; //!< The ID of the texture to attach to the FBO + bool m_multisample; //!< Whether we have to create a multisample frame buffer as well + bool m_stencil; //!< Whether we have stencil attachment + bool m_sRgb; //!< Whether we need to encode drawn pixels into sRGB color space }; } // namespace priv diff --git a/src/SFML/System/Android/Activity.hpp b/src/SFML/System/Android/Activity.hpp index 0adcf1a21..257f5c275 100644 --- a/src/SFML/System/Android/Activity.hpp +++ b/src/SFML/System/Android/Activity.hpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include @@ -73,7 +73,7 @@ struct ActivityStates void (*forwardEvent)(const Event& event); int (*processEvent)(int fd, int events, void* data); - std::map touchEvents; + std::unordered_map touchEvents; Vector2i mousePosition; bool isButtonPressed[Mouse::ButtonCount]; diff --git a/src/SFML/Window/FreeBSD/JoystickImpl.cpp b/src/SFML/Window/FreeBSD/JoystickImpl.cpp index 845e8dd60..28bd3c314 100644 --- a/src/SFML/Window/FreeBSD/JoystickImpl.cpp +++ b/src/SFML/Window/FreeBSD/JoystickImpl.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include @@ -49,8 +49,8 @@ namespace { - std::map plugged; - std::map > hatValueMap; + std::unordered_map plugged; + std::unordered_map > hatValueMap; bool isJoystick(const char *name) { diff --git a/src/SFML/Window/GlContext.cpp b/src/SFML/Window/GlContext.cpp index 51c55bf43..c9b75a7eb 100644 --- a/src/SFML/Window/GlContext.cpp +++ b/src/SFML/Window/GlContext.cpp @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include #include @@ -176,7 +176,7 @@ namespace // context is going to be destroyed // Unshareable OpenGL resources rely on this to clean up properly // whenever a context containing them is destroyed - typedef std::set > ContextDestroyCallbacks; + typedef std::unordered_map ContextDestroyCallbacks; ContextDestroyCallbacks contextDestroyCallbacks; // This structure contains all the state necessary to diff --git a/src/SFML/Window/NetBSD/JoystickImpl.cpp b/src/SFML/Window/NetBSD/JoystickImpl.cpp index 96d35f268..574eb1106 100644 --- a/src/SFML/Window/NetBSD/JoystickImpl.cpp +++ b/src/SFML/Window/NetBSD/JoystickImpl.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include @@ -44,8 +44,8 @@ namespace { - std::map plugged; - std::map > hatValueMap; + std::unordered_map plugged; + std::unordered_map > hatValueMap; bool isJoystick(const char *name) { diff --git a/src/SFML/Window/OSX/JoystickImpl.hpp b/src/SFML/Window/OSX/JoystickImpl.hpp index 3e0bb2952..4d0da40ea 100644 --- a/src/SFML/Window/OSX/JoystickImpl.hpp +++ b/src/SFML/Window/OSX/JoystickImpl.hpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include namespace sf @@ -116,9 +116,9 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - typedef long Location; - typedef std::map AxisMap; - typedef std::vector ButtonsVector; + typedef long Location; + typedef std::unordered_map AxisMap; + typedef std::vector ButtonsVector; AxisMap m_axis; ///< Axes (but not POV/Hat) of the joystick IOHIDElementRef m_hat; ///< POV/Hat axis of the joystick diff --git a/src/SFML/Window/Unix/Display.cpp b/src/SFML/Window/Unix/Display.cpp index 3bfd7f969..fb6b3d5c1 100644 --- a/src/SFML/Window/Unix/Display.cpp +++ b/src/SFML/Window/Unix/Display.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include namespace @@ -42,7 +42,7 @@ namespace unsigned int referenceCount = 0; sf::Mutex mutex; - typedef std::map AtomMap; + typedef std::unordered_map AtomMap; AtomMap atoms; }