mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-30 10:47:35 +02:00
Implement workarounds for gcc 4.4
This commit is contained in:
@ -266,6 +266,10 @@ template <>
|
|||||||
inline void reset_color<wchar_t>(FILE *stream) FMT_NOEXCEPT {
|
inline void reset_color<wchar_t>(FILE *stream) FMT_NOEXCEPT {
|
||||||
fputs(internal::data::WRESET_COLOR, stream);
|
fputs(internal::data::WRESET_COLOR, stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename S>
|
||||||
|
struct is_format_string: std::integral_constant<
|
||||||
|
bool, std::is_empty<format_string_traits<S>>::value> {};
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
|
||||||
template <
|
template <
|
||||||
|
@ -216,6 +216,14 @@ FMT_CONSTEXPR size_t length(const Char *s) {
|
|||||||
FMT_CONSTEXPR size_t length(const char *s) { return std::strlen(s); }
|
FMT_CONSTEXPR size_t length(const char *s) { return std::strlen(s); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if FMT_GCC_VERSION && FMT_GCC_VERSION < 405
|
||||||
|
template <typename... T>
|
||||||
|
struct is_constructible: std::false_type {};
|
||||||
|
#else
|
||||||
|
template <typename... T>
|
||||||
|
struct is_constructible: std::is_constructible<T...> {};
|
||||||
|
#endif
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct no_formatter_error : std::false_type {};
|
struct no_formatter_error : std::false_type {};
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
@ -644,7 +652,7 @@ inline typename std::enable_if<
|
|||||||
|
|
||||||
template <typename C, typename T, typename Char = typename C::char_type>
|
template <typename C, typename T, typename Char = typename C::char_type>
|
||||||
inline typename std::enable_if<
|
inline typename std::enable_if<
|
||||||
std::is_constructible<basic_string_view<Char>, T>::value,
|
internal::is_constructible<basic_string_view<Char>, T>::value,
|
||||||
init<C, basic_string_view<Char>, string_type>>::type
|
init<C, basic_string_view<Char>, string_type>>::type
|
||||||
make_value(const T &val) { return basic_string_view<Char>(val); }
|
make_value(const T &val) { return basic_string_view<Char>(val); }
|
||||||
|
|
||||||
@ -652,7 +660,7 @@ template <typename C, typename T, typename Char = typename C::char_type>
|
|||||||
inline typename std::enable_if<
|
inline typename std::enable_if<
|
||||||
!convert_to_int<T, Char>::value &&
|
!convert_to_int<T, Char>::value &&
|
||||||
!std::is_convertible<T, basic_string_view<Char>>::value &&
|
!std::is_convertible<T, basic_string_view<Char>>::value &&
|
||||||
!std::is_constructible<basic_string_view<Char>, T>::value,
|
!internal::is_constructible<basic_string_view<Char>, T>::value,
|
||||||
// Implicit conversion to std::string is not handled here because it's
|
// Implicit conversion to std::string is not handled here because it's
|
||||||
// unsafe: https://github.com/fmtlib/fmt/issues/729
|
// unsafe: https://github.com/fmtlib/fmt/issues/729
|
||||||
init<C, const T &, custom_type>>::type
|
init<C, const T &, custom_type>>::type
|
||||||
@ -1253,11 +1261,10 @@ namespace internal {
|
|||||||
// If S is a format string type, format_string_traints<S>::char_type gives its
|
// If S is a format string type, format_string_traints<S>::char_type gives its
|
||||||
// character type.
|
// character type.
|
||||||
template <typename S, typename Enable = void>
|
template <typename S, typename Enable = void>
|
||||||
struct format_string_traits {
|
class format_string_traits {
|
||||||
private:
|
// Use emptyness as a way to detect if format_string_traits is
|
||||||
// Use constructability as a way to detect if format_string_traits is
|
// specialized because other methods are broken on MSVC2013 or gcc 4.4.
|
||||||
// specialized because other methods are broken on MSVC2013.
|
int dummy;
|
||||||
format_string_traits();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Char>
|
template <typename Char>
|
||||||
@ -1285,11 +1292,6 @@ struct format_string_traits<
|
|||||||
basic_string_view<typename S::char_type>, S>::value>::type> :
|
basic_string_view<typename S::char_type>, S>::value>::type> :
|
||||||
format_string_traits_base<typename S::char_type> {};
|
format_string_traits_base<typename S::char_type> {};
|
||||||
|
|
||||||
template <typename S>
|
|
||||||
struct is_format_string :
|
|
||||||
std::integral_constant<
|
|
||||||
bool, std::is_constructible<format_string_traits<S>>::value> {};
|
|
||||||
|
|
||||||
template <typename S>
|
template <typename S>
|
||||||
struct is_compile_string :
|
struct is_compile_string :
|
||||||
std::integral_constant<bool, std::is_base_of<compile_string, S>::value> {};
|
std::integral_constant<bool, std::is_base_of<compile_string, S>::value> {};
|
||||||
|
Reference in New Issue
Block a user