From b3c5c2fcfafed57dcedc0a1b4ac2cbcf2ccd7a32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20B=C3=A9raud?= Date: Thu, 18 May 2023 00:44:47 -0400 Subject: [PATCH] hash: add fmt formatter --- include/opendht/infohash.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/opendht/infohash.h b/include/opendht/infohash.h index 25753614..7de93365 100644 --- a/include/opendht/infohash.h +++ b/include/opendht/infohash.h @@ -22,6 +22,7 @@ #include "rng.h" #include +#include #ifndef _WIN32 #include @@ -394,3 +395,10 @@ Hash::toString() const } } + +template +struct fmt::formatter>: formatter { + constexpr auto format(const dht::Hash& c, format_context& ctx) const { + return formatter::format(c.to_view(), ctx); + } +};