Skip to content

Commit

Permalink
Better workaround for fmt's separator
Browse files Browse the repository at this point in the history
  • Loading branch information
alabuzhev committed Jun 26, 2021
1 parent 248f4f3 commit a09945c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
15 changes: 14 additions & 1 deletion far/format.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,20 @@ WARNING_DISABLE_GCC("-Wmissing-declarations")

WARNING_DISABLE_CLANG("-Weverything")

#define FMT_STATIC_THOUSANDS_SEPARATOR ::locale.thousand_separator()
struct thousands_separator
{
operator wchar_t() const
{
return ::locale.thousand_separator();
}

operator char() const
{
return static_cast<char>(operator wchar_t());
}
};

#define FMT_STATIC_THOUSANDS_SEPARATOR (thousands_separator{})

#include "thirdparty/fmt/format.cc"

Expand Down
3 changes: 1 addition & 2 deletions far/format.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,9 @@ WARNING_DISABLE_GCC("-Wctor-dtor-privacy")

WARNING_DISABLE_CLANG("-Weverything")

#define FMT_STATIC_THOUSANDS_SEPARATOR
#include "thirdparty/fmt/fmt/format.h"
#include "thirdparty/fmt/fmt/xchar.h"

#define FMT_STATIC_THOUSANDS_SEPARATOR
#include "thirdparty/fmt/fmt/ostream.h"
#undef FMT_STATIC_THOUSANDS_SEPARATOR

Expand Down
2 changes: 1 addition & 1 deletion far/thirdparty/fmt/fmt/format-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ template <typename Char> FMT_FUNC Char decimal_point_impl(locale_ref loc) {
#else
template <typename Char>
FMT_FUNC auto thousands_sep_impl(locale_ref) -> thousands_sep_result<Char> {
return {"\03", static_cast<Char>(FMT_STATIC_THOUSANDS_SEPARATOR)};
return {"\03", FMT_STATIC_THOUSANDS_SEPARATOR};
}
template <typename Char> FMT_FUNC Char decimal_point_impl(locale_ref) {
return '.';
Expand Down

0 comments on commit a09945c

Please sign in to comment.