diff --git a/include/opendht/infohash.h b/include/opendht/infohash.h index 257536149bc74d471d68c33786cd94993fb0a488..7de93365629c4a09b161695c485f72586438cfc4 100644 --- a/include/opendht/infohash.h +++ b/include/opendht/infohash.h @@ -22,6 +22,7 @@ #include "rng.h" #include <msgpack.hpp> +#include <fmt/core.h> #ifndef _WIN32 #include <netinet/in.h> @@ -394,3 +395,10 @@ Hash<N>::toString() const } } + +template <size_t N> +struct fmt::formatter<dht::Hash<N>>: formatter<string_view> { + constexpr auto format(const dht::Hash<N>& c, format_context& ctx) const { + return formatter<string_view>::format(c.to_view(), ctx); + } +};