Consolidate FMT_HEADER_ONLY code

This commit is contained in:
Peter Bell 2020-05-07 00:47:01 +01:00
parent 6a7c7eac0b
commit 905d7c47f5

View File

@ -849,10 +849,6 @@ inline int count_digits(uint32_t n) {
#endif
template <typename Char> FMT_API std::string grouping_impl(locale_ref loc);
#ifndef FMT_HEADER_ONLY
extern template FMT_API std::string grouping_impl<char>(locale_ref loc);
extern template FMT_API std::string grouping_impl<wchar_t>(locale_ref loc);
#endif
template <typename Char> inline std::string grouping(locale_ref loc) {
return grouping_impl<char>(loc);
}
@ -861,10 +857,6 @@ template <> inline std::string grouping<wchar_t>(locale_ref loc) {
}
template <typename Char> FMT_API Char thousands_sep_impl(locale_ref loc);
#ifndef FMT_HEADER_ONLY
extern template FMT_API char thousands_sep_impl<char>(locale_ref loc);
extern template FMT_API wchar_t thousands_sep_impl<wchar_t>(locale_ref loc);
#endif
template <typename Char> inline Char thousands_sep(locale_ref loc) {
return Char(thousands_sep_impl<char>(loc));
}
@ -873,10 +865,6 @@ template <> inline wchar_t thousands_sep(locale_ref loc) {
}
template <typename Char> FMT_API Char decimal_point_impl(locale_ref loc);
#ifndef FMT_HEADER_ONLY
extern template FMT_API char decimal_point_impl(locale_ref loc);
extern template FMT_API wchar_t decimal_point_impl(locale_ref loc);
#endif
template <typename Char> inline Char decimal_point(locale_ref loc) {
return Char(decimal_point_impl<char>(loc));
}
@ -1217,31 +1205,11 @@ template <typename Char> class float_writer {
template <typename T>
int format_float(T value, int precision, float_specs specs, buffer<char>& buf);
#ifndef FMT_HEADER_ONLY
extern template
int format_float<double>(double value, int precision, float_specs specs,
buffer<char>& buf);
extern template
int format_float<long double>(long double value, int precision,
float_specs specs, buffer<char>& buf);
#endif
// Formats a floating-point number with snprintf.
template <typename T>
int snprintf_float(T value, int precision, float_specs specs,
buffer<char>& buf);
#ifndef FMT_HEADER_ONLY
int snprintf_float(float value, int precision, float_specs specs,
buffer<char>& buf) = delete;
extern template
int snprintf_float<double>(double value, int precision, float_specs specs,
buffer<char>& buf);
extern template
int snprintf_float<long double>(long double value, int precision,
float_specs specs, buffer<char>& buf);
#endif
template <typename T> T promote_float(T value) { return value; }
inline double promote_float(float value) { return static_cast<double>(value); }
@ -3369,6 +3337,28 @@ typename buffer_context<Char>::iterator internal::vformat_to(
#ifndef FMT_HEADER_ONLY
extern template format_context::iterator internal::vformat_to(
internal::buffer<char>&, string_view, basic_format_args<format_context>);
namespace internal {
extern template FMT_API std::string grouping_impl<char>(locale_ref loc);
extern template FMT_API std::string grouping_impl<wchar_t>(locale_ref loc);
extern template FMT_API char thousands_sep_impl<char>(locale_ref loc);
extern template FMT_API wchar_t thousands_sep_impl<wchar_t>(locale_ref loc);
extern template FMT_API char decimal_point_impl(locale_ref loc);
extern template FMT_API wchar_t decimal_point_impl(locale_ref loc);
extern template
int format_float<double>(double value, int precision, float_specs specs,
buffer<char>& buf);
extern template
int format_float<long double>(long double value, int precision,
float_specs specs, buffer<char>& buf);
int snprintf_float(float value, int precision, float_specs specs,
buffer<char>& buf) = delete;
extern template
int snprintf_float<double>(double value, int precision, float_specs specs,
buffer<char>& buf);
extern template
int snprintf_float<long double>(long double value, int precision,
float_specs specs, buffer<char>& buf);
}
#endif
template <typename S, typename Char = char_t<S>,