Skip to content

Commit

Permalink
Fix FMT_STATIC_THOUSANDS_SEPARATOR (#2142)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Feb 21, 2021
1 parent ab0f7d7 commit 1afebaa
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions include/fmt/format-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,8 @@ inline void fwrite_fully(const void* ptr, size_t size, size_t count,
size_t written = std::fwrite(ptr, size, count, stream);
if (written < count) FMT_THROW(system_error(errno, "cannot write to file"));
}
} // namespace detail

#if !defined(FMT_STATIC_THOUSANDS_SEPARATOR)
namespace detail {

#ifndef FMT_STATIC_THOUSANDS_SEPARATOR
template <typename Locale>
locale_ref::locale_ref(const Locale& loc) : locale_(&loc) {
static_assert(std::is_same<Locale, std::locale>::value, "");
Expand All @@ -192,19 +189,19 @@ template <typename Char> FMT_FUNC Char decimal_point_impl(locale_ref loc) {
return std::use_facet<std::numpunct<Char>>(loc.get<std::locale>())
.decimal_point();
}
} // namespace detail
#else
template <typename Char>
FMT_FUNC std::string detail::grouping_impl(locale_ref) {
FMT_FUNC std::string grouping_impl(locale_ref) {
return "\03";
}
template <typename Char> FMT_FUNC Char detail::thousands_sep_impl(locale_ref) {
template <typename Char> FMT_FUNC Char thousands_sep_impl(locale_ref) {
return FMT_STATIC_THOUSANDS_SEPARATOR;
}
template <typename Char> FMT_FUNC Char detail::decimal_point_impl(locale_ref) {
template <typename Char> FMT_FUNC Char decimal_point_impl(locale_ref) {
return '.';
}
#endif
} // namespace detail

FMT_API FMT_FUNC format_error::~format_error() FMT_NOEXCEPT = default;
FMT_API FMT_FUNC system_error::~system_error() FMT_NOEXCEPT = default;
Expand Down

0 comments on commit 1afebaa

Please sign in to comment.