mirror of
https://github.com/fmtlib/fmt.git
synced 2025-12-02 07:09:44 +01:00
Make formatter override implicit conversion to a C string
This commit is contained in:
@@ -900,7 +900,8 @@ template <typename Context> struct arg_mapper {
|
||||
template <typename T,
|
||||
FMT_ENABLE_IF(
|
||||
std::is_constructible<basic_string_view<char_type>, T>::value &&
|
||||
!is_string<T>::value)>
|
||||
!is_string<T>::value && !has_formatter<T, Context>::value &&
|
||||
!has_fallback_formatter<T, Context>::value)>
|
||||
FMT_CONSTEXPR basic_string_view<char_type> map(const T& val) {
|
||||
return basic_string_view<char_type>(val);
|
||||
}
|
||||
@@ -909,7 +910,8 @@ template <typename Context> struct arg_mapper {
|
||||
FMT_ENABLE_IF(
|
||||
std::is_constructible<std_string_view<char_type>, T>::value &&
|
||||
!std::is_constructible<basic_string_view<char_type>, T>::value &&
|
||||
!is_string<T>::value && !has_formatter<T, Context>::value)>
|
||||
!is_string<T>::value && !has_formatter<T, Context>::value &&
|
||||
!has_fallback_formatter<T, Context>::value)>
|
||||
FMT_CONSTEXPR basic_string_view<char_type> map(const T& val) {
|
||||
return std_string_view<char_type>(val);
|
||||
}
|
||||
@@ -946,10 +948,8 @@ template <typename Context> struct arg_mapper {
|
||||
typename T,
|
||||
FMT_ENABLE_IF(
|
||||
!is_string<T>::value && !is_char<T>::value &&
|
||||
!std::is_constructible<basic_string_view<char_type>, T>::value &&
|
||||
(has_formatter<T, Context>::value ||
|
||||
(has_fallback_formatter<T, Context>::value &&
|
||||
!std::is_constructible<std_string_view<char_type>, T>::value)))>
|
||||
has_fallback_formatter<T, Context>::value))>
|
||||
FMT_CONSTEXPR const T& map(const T& val) {
|
||||
return val;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user