mirror of
https://github.com/fmtlib/fmt.git
synced 2025-01-29 03:32:42 +00:00
Simplify to_ascii
This commit is contained in:
parent
6c3b2d491e
commit
74ffea0dcf
@ -2132,11 +2132,8 @@ struct dynamic_format_specs : format_specs<Char> {
|
||||
};
|
||||
|
||||
// Converts a character to ASCII. Returns '\0' on conversion failure.
|
||||
template <typename Char, FMT_ENABLE_IF(std::is_integral<Char>::value)>
|
||||
constexpr auto to_ascii(Char c) -> char {
|
||||
return c <= 0xff ? static_cast<char>(c) : '\0';
|
||||
}
|
||||
template <typename Char, FMT_ENABLE_IF(std::is_enum<Char>::value)>
|
||||
template <typename Char, FMT_ENABLE_IF(std::is_integral<Char>::value ||
|
||||
std::is_enum<Char>::value)>
|
||||
constexpr auto to_ascii(Char c) -> char {
|
||||
return c <= 0xff ? static_cast<char>(c) : '\0';
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user