mirror of
https://github.com/shadps4-emu/ext-fmt.git
synced 2025-03-01 06:35:37 +00:00
Fix handling of set_debug_format
This commit is contained in:
parent
56d7a8c157
commit
3eb3aef575
@ -4097,13 +4097,10 @@ class format_int {
|
||||
|
||||
template <typename T, typename Char>
|
||||
struct formatter<T, Char, enable_if_t<detail::has_format_as<T>::value>>
|
||||
: private formatter<detail::format_as_t<T>, Char> {
|
||||
using base = formatter<detail::format_as_t<T>, Char>;
|
||||
using base::parse;
|
||||
using base::set_debug_format;
|
||||
|
||||
: formatter<detail::format_as_t<T>, Char> {
|
||||
template <typename FormatContext>
|
||||
auto format(const T& value, FormatContext& ctx) const -> decltype(ctx.out()) {
|
||||
using base = formatter<detail::format_as_t<T>, Char>;
|
||||
return base::format(format_as(value), ctx);
|
||||
}
|
||||
};
|
||||
|
@ -528,3 +528,16 @@ TEST(ranges_test, container_adaptor) {
|
||||
EXPECT_EQ(fmt::format("{}", m), "[1, 2]");
|
||||
}
|
||||
}
|
||||
|
||||
struct tieable {
|
||||
int a = 3;
|
||||
double b = 0.42;
|
||||
};
|
||||
|
||||
auto format_as(const tieable& t) -> std::tuple<int, double> {
|
||||
return std::tie(t.a, t.b);
|
||||
}
|
||||
|
||||
TEST(ranges_test, format_as_tie) {
|
||||
EXPECT_EQ(fmt::format("{}", tieable()), "(3, 0.42)");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user