workaround MSVC bug
This commit is contained in:
parent
54d6d5bc84
commit
e805e8ee29
@ -769,7 +769,13 @@ template <typename Char, typename Rep, typename OutputIt,
|
|||||||
FMT_ENABLE_IF(std::is_integral<Rep>::value)>
|
FMT_ENABLE_IF(std::is_integral<Rep>::value)>
|
||||||
OutputIt format_duration_value(OutputIt out, Rep val, int) {
|
OutputIt format_duration_value(OutputIt out, Rep val, int) {
|
||||||
static FMT_CONSTEXPR_DECL const Char format[] = {'{', '}', 0};
|
static FMT_CONSTEXPR_DECL const Char format[] = {'{', '}', 0};
|
||||||
|
|
||||||
|
#if defined(FMT_MSC_VER) && FMT_MSC_VER < 1928
|
||||||
|
return vformat_to(out, to_string_view(format),
|
||||||
|
make_format_args<buffer_context<Char>>(val));
|
||||||
|
#else
|
||||||
return format_to(out, FMT_STRING(format), val);
|
return format_to(out, FMT_STRING(format), val);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Char, typename Rep, typename OutputIt,
|
template <typename Char, typename Rep, typename OutputIt,
|
||||||
@ -777,9 +783,22 @@ template <typename Char, typename Rep, typename OutputIt,
|
|||||||
OutputIt format_duration_value(OutputIt out, Rep val, int precision) {
|
OutputIt format_duration_value(OutputIt out, Rep val, int precision) {
|
||||||
static FMT_CONSTEXPR_DECL const Char pr_f[] = {'{', ':', '.', '{',
|
static FMT_CONSTEXPR_DECL const Char pr_f[] = {'{', ':', '.', '{',
|
||||||
'}', 'f', '}', 0};
|
'}', 'f', '}', 0};
|
||||||
if (precision >= 0) return format_to(out, FMT_STRING(pr_f), val, precision);
|
if (precision >= 0) {
|
||||||
|
#if defined(FMT_MSC_VER) && FMT_MSC_VER < 1928
|
||||||
|
return vformat_to(out, to_string_view(pr_f),
|
||||||
|
make_format_args<buffer_context<Char>>(val, precision));
|
||||||
|
#else
|
||||||
|
return format_to(out, FMT_STRING(pr_f), val, precision);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
static FMT_CONSTEXPR_DECL const Char fp_f[] = {'{', ':', 'g', '}', 0};
|
static FMT_CONSTEXPR_DECL const Char fp_f[] = {'{', ':', 'g', '}', 0};
|
||||||
|
|
||||||
|
#if defined(FMT_MSC_VER) && FMT_MSC_VER < 1928
|
||||||
|
return vformat_to(out, to_string_view(fp_f),
|
||||||
|
make_format_args<buffer_context<Char>>(val));
|
||||||
|
#else
|
||||||
return format_to(out, FMT_STRING(fp_f), val);
|
return format_to(out, FMT_STRING(fp_f), val);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Char, typename OutputIt>
|
template <typename Char, typename OutputIt>
|
||||||
@ -800,11 +819,23 @@ OutputIt format_duration_unit(OutputIt out) {
|
|||||||
if (const char* unit = get_units<Period>())
|
if (const char* unit = get_units<Period>())
|
||||||
return copy_unit(string_view(unit), out, Char());
|
return copy_unit(string_view(unit), out, Char());
|
||||||
static FMT_CONSTEXPR_DECL const Char num_f[] = {'[', '{', '}', ']', 's', 0};
|
static FMT_CONSTEXPR_DECL const Char num_f[] = {'[', '{', '}', ']', 's', 0};
|
||||||
if (const_check(Period::den == 1))
|
if (const_check(Period::den == 1)) {
|
||||||
|
#if defined(FMT_MSC_VER) && FMT_MSC_VER < 1928
|
||||||
|
return vformat_to(out, to_string_view(num_f),
|
||||||
|
make_format_args<buffer_context<Char>>(Period::num));
|
||||||
|
#else
|
||||||
return format_to(out, FMT_STRING(num_f), Period::num);
|
return format_to(out, FMT_STRING(num_f), Period::num);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
static FMT_CONSTEXPR_DECL const Char num_def_f[] = {'[', '{', '}', '/', '{',
|
static FMT_CONSTEXPR_DECL const Char num_def_f[] = {'[', '{', '}', '/', '{',
|
||||||
'}', ']', 's', 0};
|
'}', ']', 's', 0};
|
||||||
|
#if defined(FMT_MSC_VER) && FMT_MSC_VER < 1928
|
||||||
|
return vformat_to(
|
||||||
|
out, to_string_view(num_def_f),
|
||||||
|
make_format_args<buffer_context<Char>>(Period::num, Period::den));
|
||||||
|
#else
|
||||||
return format_to(out, FMT_STRING(num_def_f), Period::num, Period::den);
|
return format_to(out, FMT_STRING(num_def_f), Period::num, Period::den);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename FormatContext, typename OutputIt, typename Rep,
|
template <typename FormatContext, typename OutputIt, typename Rep,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user