From 2c4ffe997a0ac20f4bd1f4928e116f67a93260ef Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Mon, 15 May 2023 15:41:47 -0600 Subject: [PATCH] Implement predicate with lambdas --- src/SFML/Window/macOS/JoystickImpl.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/SFML/Window/macOS/JoystickImpl.cpp b/src/SFML/Window/macOS/JoystickImpl.cpp index 8155096ba..87d776182 100644 --- a/src/SFML/Window/macOS/JoystickImpl.cpp +++ b/src/SFML/Window/macOS/JoystickImpl.cpp @@ -38,10 +38,6 @@ namespace { -bool joystickButtonSortPredicate(IOHIDElementRef b1, IOHIDElementRef b2) -{ - return IOHIDElementGetUsage(b1) < IOHIDElementGetUsage(b2); -} // Convert a CFStringRef to std::string std::string stringFromCFString(CFStringRef cfString) @@ -320,7 +316,9 @@ bool JoystickImpl::open(unsigned int index) // Ensure that the buttons will be indexed in the same order as their // HID Usage (assigned by manufacturer and/or a driver). - std::sort(m_buttons.begin(), m_buttons.end(), joystickButtonSortPredicate); + std::sort(m_buttons.begin(), + m_buttons.end(), + [](IOHIDElementRef b1, IOHIDElementRef b2) { return IOHIDElementGetUsage(b1) < IOHIDElementGetUsage(b2); }); // Retain all these objects for personal use for (IOHIDElementRef iohidElementRef : m_buttons)