diff --git a/src/SFML/Audio/AudioResource.cpp b/src/SFML/Audio/AudioResource.cpp index f691c7ad3..1d476f2ee 100644 --- a/src/SFML/Audio/AudioResource.cpp +++ b/src/SFML/Audio/AudioResource.cpp @@ -37,7 +37,7 @@ namespace sf //////////////////////////////////////////////////////////// AudioResource::AudioResource() : m_device( - []() + [] { // Ensure we only ever create a single instance of an // AudioDevice that is shared between all AudioResources diff --git a/src/SFML/Graphics/Shader.cpp b/src/SFML/Graphics/Shader.cpp index 3d7b0c5ff..4bd99fdab 100644 --- a/src/SFML/Graphics/Shader.cpp +++ b/src/SFML/Graphics/Shader.cpp @@ -66,7 +66,7 @@ namespace // Retrieve the maximum number of texture units available std::size_t getMaxTextureUnits() { - static const GLint maxUnits = []() + static const GLint maxUnits = [] { GLint value = 0; glCheck(glGetIntegerv(GLEXT_GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &value)); @@ -739,7 +739,7 @@ void Shader::bind(const Shader* shader) //////////////////////////////////////////////////////////// bool Shader::isAvailable() { - static const bool available = []() + static const bool available = [] { const TransientContextLock contextLock; @@ -757,7 +757,7 @@ bool Shader::isAvailable() //////////////////////////////////////////////////////////// bool Shader::isGeometryAvailable() { - static const bool available = []() + static const bool available = [] { const TransientContextLock contextLock; diff --git a/src/SFML/Graphics/Texture.cpp b/src/SFML/Graphics/Texture.cpp index 21ee7c35d..422197908 100644 --- a/src/SFML/Graphics/Texture.cpp +++ b/src/SFML/Graphics/Texture.cpp @@ -916,7 +916,7 @@ void Texture::bind(const Texture* texture, CoordinateType coordinateType) //////////////////////////////////////////////////////////// unsigned int Texture::getMaximumSize() { - static const unsigned int size = []() + static const unsigned int size = [] { const TransientContextLock transientLock; diff --git a/src/SFML/Graphics/VertexBuffer.cpp b/src/SFML/Graphics/VertexBuffer.cpp index 05a126725..1067e7768 100644 --- a/src/SFML/Graphics/VertexBuffer.cpp +++ b/src/SFML/Graphics/VertexBuffer.cpp @@ -333,14 +333,14 @@ VertexBuffer::Usage VertexBuffer::getUsage() const //////////////////////////////////////////////////////////// bool VertexBuffer::isAvailable() { - static const bool available = []() -> bool + static const bool available = [] { const TransientContextLock contextLock; // Make sure that extensions are initialized sf::priv::ensureExtensionsInit(); - return GLEXT_vertex_buffer_object; + return GLEXT_vertex_buffer_object != 0; }(); return available; diff --git a/src/SFML/Window/EglContext.cpp b/src/SFML/Window/EglContext.cpp index c8489c2ca..f42a41b14 100644 --- a/src/SFML/Window/EglContext.cpp +++ b/src/SFML/Window/EglContext.cpp @@ -87,7 +87,7 @@ void ensureInit() static std::once_flag flag; std::call_once(flag, - []() + [] { if (!gladLoaderLoadEGL(EGL_NO_DISPLAY)) { diff --git a/src/SFML/Window/GlContext.cpp b/src/SFML/Window/GlContext.cpp index d250210fd..510af4164 100644 --- a/src/SFML/Window/GlContext.cpp +++ b/src/SFML/Window/GlContext.cpp @@ -461,7 +461,7 @@ struct GlContext::Impl //////////////////////////////////////////////////////////// std::shared_ptr unsharedGlObjects; //!< The current object's handle to unshared objects const std::uint64_t id{ - []() + [] { static std::atomic atomicId(1); // start at 1, zero is "no context" return atomicId.fetch_add(1); diff --git a/src/SFML/Window/WindowBase.cpp b/src/SFML/Window/WindowBase.cpp index aa72f8e93..adf889f4f 100644 --- a/src/SFML/Window/WindowBase.cpp +++ b/src/SFML/Window/WindowBase.cpp @@ -210,7 +210,7 @@ void WindowBase::setMinimumSize(const std::optional& minimumSize) { if (m_impl) { - [[maybe_unused]] const auto validateMinimumSize = [this, minimumSize]() + [[maybe_unused]] const auto validateMinimumSize = [this, minimumSize] { if (!minimumSize.has_value() || !m_impl->getMaximumSize().has_value()) return true; @@ -229,7 +229,7 @@ void WindowBase::setMaximumSize(const std::optional& maximumSize) { if (m_impl) { - [[maybe_unused]] const auto validateMaxiumSize = [this, maximumSize]() + [[maybe_unused]] const auto validateMaxiumSize = [this, maximumSize] { if (!maximumSize.has_value() || !m_impl->getMinimumSize().has_value()) return true;