@@ -1297,6 +1297,17 @@ template <> inline auto decimal_point(locale_ref loc) -> wchar_t {
1297
1297
return decimal_point_impl<wchar_t >(loc);
1298
1298
}
1299
1299
1300
+ #ifndef FMT_HEADER_ONLY
1301
+ FMT_BEGIN_EXPORT
1302
+ extern template FMT_API auto thousands_sep_impl<char >(locale_ref)
1303
+ -> thousands_sep_result<char >;
1304
+ extern template FMT_API auto thousands_sep_impl<wchar_t >(locale_ref)
1305
+ -> thousands_sep_result<wchar_t >;
1306
+ extern template FMT_API auto decimal_point_impl (locale_ref) -> char;
1307
+ extern template FMT_API auto decimal_point_impl (locale_ref) -> wchar_t;
1308
+ FMT_END_EXPORT
1309
+ #endif // FMT_HEADER_ONLY
1310
+
1300
1311
// Compares two characters for equality.
1301
1312
template <typename Char> auto equal2 (const Char* lhs, const char * rhs) -> bool {
1302
1313
return lhs[0 ] == Char (rhs[0 ]) && lhs[1 ] == Char (rhs[1 ]);
@@ -3779,44 +3790,13 @@ template <typename Char> struct format_handler {
3779
3790
FMT_NORETURN void on_error (const char * message) { report_error (message); }
3780
3791
};
3781
3792
3782
- // DEPRECATED!
3783
- template <typename Char = char > struct vformat_args {
3784
- using type = basic_format_args<buffered_context<Char>>;
3785
- };
3786
- template <> struct vformat_args <char > {
3787
- using type = format_args;
3788
- };
3789
-
3790
- template <typename Char>
3791
- void vformat_to (buffer<Char>& buf, basic_string_view<Char> fmt,
3792
- typename vformat_args<Char>::type args, locale_ref loc = {}) {
3793
- auto out = basic_appender<Char>(buf);
3794
- parse_format_string (
3795
- fmt, format_handler<Char>{parse_context<Char>(fmt), {out, args, loc}});
3796
- }
3797
-
3798
3793
using format_func = void (*)(detail::buffer<char >&, int , const char *);
3794
+ FMT_API void do_report_error (format_func func, int error_code,
3795
+ const char * message) noexcept ;
3799
3796
3800
3797
FMT_API void format_error_code (buffer<char >& out, int error_code,
3801
3798
string_view message) noexcept ;
3802
3799
3803
- using fmt::report_error;
3804
- FMT_API void report_error (format_func func, int error_code,
3805
- const char * message) noexcept ;
3806
-
3807
- FMT_BEGIN_EXPORT
3808
-
3809
- #ifndef FMT_HEADER_ONLY
3810
- extern template FMT_API auto thousands_sep_impl<char >(locale_ref)
3811
- -> thousands_sep_result<char >;
3812
- extern template FMT_API auto thousands_sep_impl<wchar_t >(locale_ref)
3813
- -> thousands_sep_result<wchar_t >;
3814
- extern template FMT_API auto decimal_point_impl (locale_ref) -> char;
3815
- extern template FMT_API auto decimal_point_impl (locale_ref) -> wchar_t;
3816
- #endif // FMT_HEADER_ONLY
3817
-
3818
- FMT_END_EXPORT
3819
-
3820
3800
template <typename T, typename Char, type TYPE>
3821
3801
template <typename FormatContext>
3822
3802
FMT_CONSTEXPR auto native_formatter<T, Char, TYPE>::format(
@@ -3830,21 +3810,26 @@ FMT_CONSTEXPR auto native_formatter<T, Char, TYPE>::format(
3830
3810
specs_.precision_ref , ctx);
3831
3811
return write <Char>(ctx.out (), val, specs, ctx.locale ());
3832
3812
}
3813
+
3814
+ // DEPRECATED!
3815
+ template <typename Char = char > struct vformat_args {
3816
+ using type = basic_format_args<buffered_context<Char>>;
3817
+ };
3818
+ template <> struct vformat_args <char > {
3819
+ using type = format_args;
3820
+ };
3821
+
3822
+ template <typename Char>
3823
+ void vformat_to (buffer<Char>& buf, basic_string_view<Char> fmt,
3824
+ typename vformat_args<Char>::type args, locale_ref loc = {}) {
3825
+ auto out = basic_appender<Char>(buf);
3826
+ parse_format_string (
3827
+ fmt, format_handler<Char>{parse_context<Char>(fmt), {out, args, loc}});
3828
+ }
3833
3829
} // namespace detail
3834
3830
3835
3831
FMT_BEGIN_EXPORT
3836
3832
3837
- template <typename T, typename Char>
3838
- struct formatter <T, Char, void_t <detail::format_as_result<T>>>
3839
- : formatter<detail::format_as_result<T>, Char> {
3840
- template <typename FormatContext>
3841
- FMT_CONSTEXPR auto format (const T& value, FormatContext& ctx) const
3842
- -> decltype(ctx.out()) {
3843
- auto && val = format_as (value); // Make an lvalue reference for format.
3844
- return formatter<detail::format_as_result<T>, Char>::format (val, ctx);
3845
- }
3846
- };
3847
-
3848
3833
#define FMT_FORMAT_AS (Type, Base ) \
3849
3834
template <typename Char> \
3850
3835
struct formatter <Type, Char> : formatter<Base, Char> { \
@@ -3884,6 +3869,17 @@ struct formatter<detail::float128, Char>
3884
3869
: detail::native_formatter<detail::float128, Char,
3885
3870
detail::type::float_type> {};
3886
3871
3872
+ template <typename T, typename Char>
3873
+ struct formatter <T, Char, void_t <detail::format_as_result<T>>>
3874
+ : formatter<detail::format_as_result<T>, Char> {
3875
+ template <typename FormatContext>
3876
+ FMT_CONSTEXPR auto format (const T& value, FormatContext& ctx) const
3877
+ -> decltype(ctx.out()) {
3878
+ auto && val = format_as (value); // Make an lvalue reference for format.
3879
+ return formatter<detail::format_as_result<T>, Char>::format (val, ctx);
3880
+ }
3881
+ };
3882
+
3887
3883
/* *
3888
3884
* Converts `p` to `const void*` for pointer formatting.
3889
3885
*
0 commit comments