From 6028ebcf8a76adbe897179d39dc719ea68b2c6ee Mon Sep 17 00:00:00 2001 From: tcoyvwac <53616399+tcoyvwac@users.noreply.github.com> Date: Tue, 3 Oct 2023 13:04:28 +0200 Subject: [PATCH] layer: Prefer C++11 std::any_of over '03 idiom --- layer/VkLayer_FROG_gamescope_wsi.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/layer/VkLayer_FROG_gamescope_wsi.cpp b/layer/VkLayer_FROG_gamescope_wsi.cpp index 657adff277..0149b4bac3 100644 --- a/layer/VkLayer_FROG_gamescope_wsi.cpp +++ b/layer/VkLayer_FROG_gamescope_wsi.cpp @@ -38,8 +38,8 @@ namespace GamescopeWSILayer { } static bool contains(const std::vector vec, std::string_view lookupValue) { - return std::find_if(vec.begin(), vec.end(), - [=](const char* value) { return value == lookupValue; }) != vec.end(); + return std::any_of(vec.begin(), vec.end(), + [=](const char* value) { return value == lookupValue; }); } static int waylandPumpEvents(wl_display *display) { @@ -762,11 +762,10 @@ namespace GamescopeWSILayer { pDispatch->PhysicalDevice, swapchainInfo.surface); - bool supportedSwapchainFormat = std::find_if( + bool supportedSwapchainFormat = std::any_of( supportedSurfaceFormats.begin(), supportedSurfaceFormats.end(), - [=](VkSurfaceFormatKHR value) { return value.format == swapchainInfo.imageFormat; }) - != supportedSurfaceFormats.end(); + [=](VkSurfaceFormatKHR value) { return value.format == swapchainInfo.imageFormat; }); if (!supportedSwapchainFormat) { fprintf(stderr, "[Gamescope WSI] Refusing to make swapchain (unsupported VkFormat) for xid: 0x%0x - format: %s - colorspace: %s - flip: %s\n",