mirror of
https://github.com/fmtlib/fmt.git
synced 2025-11-27 12:49:46 +01:00
Make formatter specializations override implicit conversions
This commit is contained in:
@@ -853,8 +853,8 @@ void make_value(const T*) {
|
||||
}
|
||||
|
||||
template <typename C, typename T,
|
||||
FMT_ENABLE_IF(convert_to_int<T, typename C::char_type>::value&&
|
||||
std::is_enum<T>::value)>
|
||||
FMT_ENABLE_IF(std::is_enum<T>::value&&
|
||||
convert_to_int<T, typename C::char_type>::value)>
|
||||
inline init<C, int, int_type> make_value(const T& val) {
|
||||
return static_cast<int>(val);
|
||||
}
|
||||
@@ -873,6 +873,14 @@ inline init<C, const T&, custom_type> make_value(const T& val) {
|
||||
return val;
|
||||
}
|
||||
|
||||
template <typename C, typename T,
|
||||
FMT_ENABLE_IF(std::is_class<T>::value&& std::is_convertible<
|
||||
T, int>::value&& is_formattable<T, C>::value &&
|
||||
!std::is_same<T, typename C::char_type>::value)>
|
||||
inline init<C, const T&, custom_type> make_value(const T& val) {
|
||||
return val;
|
||||
}
|
||||
|
||||
template <typename C, typename T>
|
||||
init<C, const void*, named_arg_type> make_value(
|
||||
const named_arg<T, typename C::char_type>& val) {
|
||||
|
||||
Reference in New Issue
Block a user