|
|
|
@ -18,6 +18,7 @@ |
|
|
|
|
#include <string.h> |
|
|
|
|
#include <wchar.h> |
|
|
|
|
|
|
|
|
|
#include <algorithm> |
|
|
|
|
#include <cstdio> |
|
|
|
|
#include <iomanip> |
|
|
|
|
#include <limits> |
|
|
|
@ -25,10 +26,12 @@ |
|
|
|
|
#include <sstream> |
|
|
|
|
#include <string> |
|
|
|
|
#include <type_traits> |
|
|
|
|
#include <utility> |
|
|
|
|
|
|
|
|
|
#include "absl/base/port.h" |
|
|
|
|
#include "absl/meta/type_traits.h" |
|
|
|
|
#include "absl/numeric/int128.h" |
|
|
|
|
#include "absl/strings/internal/has_absl_stringify.h" |
|
|
|
|
#include "absl/strings/internal/str_format/extension.h" |
|
|
|
|
#include "absl/strings/string_view.h" |
|
|
|
|
|
|
|
|
@ -271,7 +274,8 @@ IntegralConvertResult FormatConvertImpl(T v, FormatConversionSpecImpl conv, |
|
|
|
|
// FormatArgImpl will use the underlying Convert functions instead.
|
|
|
|
|
template <typename T> |
|
|
|
|
typename std::enable_if<std::is_enum<T>::value && |
|
|
|
|
!HasUserDefinedConvert<T>::value, |
|
|
|
|
!HasUserDefinedConvert<T>::value && |
|
|
|
|
!strings_internal::HasAbslStringify<T>::value, |
|
|
|
|
IntegralConvertResult>::type |
|
|
|
|
FormatConvertImpl(T v, FormatConversionSpecImpl conv, FormatSinkImpl* sink); |
|
|
|
|
|
|
|
|
@ -384,7 +388,8 @@ class FormatArgImpl { |
|
|
|
|
template <typename T, typename = void> |
|
|
|
|
struct DecayType { |
|
|
|
|
static constexpr bool kHasUserDefined = |
|
|
|
|
str_format_internal::HasUserDefinedConvert<T>::value; |
|
|
|
|
str_format_internal::HasUserDefinedConvert<T>::value || |
|
|
|
|
strings_internal::HasAbslStringify<T>::value; |
|
|
|
|
using type = typename std::conditional< |
|
|
|
|
!kHasUserDefined && std::is_convertible<T, const char*>::value, |
|
|
|
|
const char*, |
|
|
|
@ -396,6 +401,7 @@ class FormatArgImpl { |
|
|
|
|
struct DecayType<T, |
|
|
|
|
typename std::enable_if< |
|
|
|
|
!str_format_internal::HasUserDefinedConvert<T>::value && |
|
|
|
|
!strings_internal::HasAbslStringify<T>::value && |
|
|
|
|
std::is_enum<T>::value>::type> { |
|
|
|
|
using type = typename std::underlying_type<T>::type; |
|
|
|
|
}; |
|
|
|
|