@@ -2799,35 +2799,25 @@ FMT_API void vprint_mojibake(FILE*, string_view, format_args, bool = false);
2799
2799
#ifndef _WIN32
2800
2800
inline void vprint_mojibake (FILE*, string_view, format_args, bool ) {}
2801
2801
#endif
2802
- } // namespace detail
2803
-
2804
- FMT_BEGIN_EXPORT
2805
2802
2806
- // A formatter specialization for natively supported types.
2807
- template <typename T, typename Char>
2808
- struct formatter <T, Char,
2809
- enable_if_t <detail::type_constant<T, Char>::value !=
2810
- detail::type::custom_type>> {
2803
+ template <typename T, typename Char, type TYPE> struct native_formatter {
2811
2804
private:
2812
- detail:: dynamic_format_specs<Char> specs_;
2805
+ dynamic_format_specs<Char> specs_;
2813
2806
2814
2807
public:
2815
2808
using nonlocking = void ;
2816
2809
2817
2810
template <typename ParseContext>
2818
2811
FMT_CONSTEXPR auto parse (ParseContext& ctx) -> const Char* {
2819
2812
if (ctx.begin () == ctx.end () || *ctx.begin () == ' }' ) return ctx.begin ();
2820
- auto type = detail::type_constant<T, Char>::value;
2821
- auto end =
2822
- detail::parse_format_specs (ctx.begin (), ctx.end (), specs_, ctx, type);
2823
- if (type == detail::type::char_type) detail::check_char_specs (specs_);
2813
+ auto end = parse_format_specs (ctx.begin (), ctx.end (), specs_, ctx, TYPE);
2814
+ if (TYPE == type::char_type) check_char_specs (specs_);
2824
2815
return end;
2825
2816
}
2826
2817
2827
- template <detail::type U = detail::type_constant<T, Char>::value,
2828
- FMT_ENABLE_IF (U == detail::type::string_type ||
2829
- U == detail::type::cstring_type ||
2830
- U == detail::type::char_type)>
2818
+ template <type U = TYPE,
2819
+ FMT_ENABLE_IF (U == type::string_type || U == type::cstring_type ||
2820
+ U == type::char_type)>
2831
2821
FMT_CONSTEXPR void set_debug_format (bool set = true ) {
2832
2822
specs_.type = set ? presentation_type::debug : presentation_type::none;
2833
2823
}
@@ -2836,6 +2826,17 @@ struct formatter<T, Char,
2836
2826
FMT_CONSTEXPR auto format (const T& val, FormatContext& ctx) const
2837
2827
-> decltype(ctx.out());
2838
2828
};
2829
+ } // namespace detail
2830
+
2831
+ FMT_BEGIN_EXPORT
2832
+
2833
+ // A formatter specialization for natively supported types.
2834
+ template <typename T, typename Char>
2835
+ struct formatter <T, Char,
2836
+ enable_if_t <detail::type_constant<T, Char>::value !=
2837
+ detail::type::custom_type>>
2838
+ : detail::native_formatter<T, Char, detail::type_constant<T, Char>::value> {
2839
+ };
2839
2840
2840
2841
template <typename Char = char > struct runtime_format_string {
2841
2842
basic_string_view<Char> str;
0 commit comments