Add format_as support for std::variant and std::expected formatters (#4575)

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
This commit is contained in:
Vladislav Shchapov
2025-10-19 02:05:21 +05:00
committed by GitHub
parent 378a5ab3c1
commit 85f6ecc7a0
4 changed files with 66 additions and 24 deletions

View File

@@ -763,6 +763,14 @@ template <typename T> struct allocator : private std::decay<void> {
}
};
template <typename Formatter>
FMT_CONSTEXPR auto maybe_set_debug_format(Formatter& f, bool set)
-> decltype(f.set_debug_format(set)) {
f.set_debug_format(set);
}
template <typename Formatter>
FMT_CONSTEXPR void maybe_set_debug_format(Formatter&, ...) {}
} // namespace detail
FMT_BEGIN_EXPORT