Skip to content

Commit

Permalink
layer: Prefer C++11 std::any_of over '03 idiom
Browse files Browse the repository at this point in the history
  • Loading branch information
tcoyvwac authored and misyltoad committed Oct 16, 2023
1 parent dd851e5 commit 6028ebc
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions layer/VkLayer_FROG_gamescope_wsi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ namespace GamescopeWSILayer {
}

static bool contains(const std::vector<const char *> 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) {
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 6028ebc

Please sign in to comment.