Reduce template instantiations

This commit is contained in:
Victor Zverovich
2022-12-30 07:30:28 -08:00
parent 7e5a959564
commit 8fe4d97d5e
2 changed files with 18 additions and 20 deletions

View File

@@ -120,10 +120,12 @@ struct custom_char {
template <typename T>
constexpr custom_char(T val) : value(static_cast<int>(val)) {}
operator int() const { return value; }
operator char() const {
return value <= 0xff ? static_cast<char>(value) : '\0';
}
};
int to_ascii(custom_char c) { return c; }
auto to_ascii(custom_char c) -> char { return c; }
FMT_BEGIN_NAMESPACE
template <> struct is_char<custom_char> : std::true_type {};