phosphor-host-postd: Convert to use bind_front for C++20
Using bind_front instead of bind for better readability and efficient
function binding.
Change-Id: Ia247d00c4b085de96605a07176cd22fbfeac1d55
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/main.cpp b/main.cpp
index 1ccfd21..7ba238c 100644
--- a/main.cpp
+++ b/main.cpp
@@ -25,6 +25,7 @@
#include <cstdint>
#include <exception>
+#include <functional>
#include <iostream>
#include <optional>
#include <sdeventplus/event.hpp>
@@ -51,8 +52,8 @@
* Callback handling IO event from the POST code fd. i.e. there is new
* POST code available to read.
*/
-void PostCodeEventHandler(sdeventplus::source::IO& s, int postFd, uint32_t,
- PostReporter* reporter, bool verbose)
+void PostCodeEventHandler(PostReporter* reporter, bool verbose,
+ sdeventplus::source::IO& s, int postFd, uint32_t)
{
uint64_t code = 0;
ssize_t readb;
@@ -180,9 +181,7 @@
{
reporterSource.emplace(
event, postFd, EPOLLIN | EPOLLET,
- std::bind(PostCodeEventHandler, std::placeholders::_1,
- std::placeholders::_2, std::placeholders::_3,
- &reporter, verbose));
+ std::bind_front(PostCodeEventHandler, &reporter, verbose));
}
// Enable bus to handle incoming IO and bus events
bus.attach_event(event.get(), SD_EVENT_PRIORITY_NORMAL);