make code c++98 compatible
This commit is contained in:
parent
76e7f8fe41
commit
e7f13d05b8
@ -267,6 +267,14 @@ typedef __int64 intmax_t;
|
|||||||
(FMT_GCC_VERSION >= 303 && FMT_HAS_GXX_CXX11))
|
(FMT_GCC_VERSION >= 303 && FMT_HAS_GXX_CXX11))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Checks if decltype v1.1 is supported
|
||||||
|
// http://en.cppreference.com/w/cpp/compiler_support
|
||||||
|
#define FMT_HAS_DECLTYPE_INCOMPLETE_RETURN_TYPES \
|
||||||
|
(FMT_HAS_FEATURE(cxx_decltype_incomplete_return_types) || \
|
||||||
|
(FMT_GCC_VERSION >= 408 && FMT_HAS_GXX_CXX11) || \
|
||||||
|
FMT_MSC_VER >= 1900 || \
|
||||||
|
FMT_ICC_VERSION >= 1200)
|
||||||
|
|
||||||
#ifdef FMT_HEADER_ONLY
|
#ifdef FMT_HEADER_ONLY
|
||||||
// If header only do not use extern templates.
|
// If header only do not use extern templates.
|
||||||
# undef FMT_USE_EXTERN_TEMPLATES
|
# undef FMT_USE_EXTERN_TEMPLATES
|
||||||
|
|||||||
@ -74,6 +74,7 @@ struct ConvertToIntImpl<T, true> {
|
|||||||
// Write the content of w to os.
|
// Write the content of w to os.
|
||||||
void write(std::ostream &os, Writer &w);
|
void write(std::ostream &os, Writer &w);
|
||||||
|
|
||||||
|
#ifdef FMT_HAS_DECLTYPE_INCOMPLETE_RETURN_TYPES
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class is_streamable {
|
class is_streamable {
|
||||||
template<typename U>
|
template<typename U>
|
||||||
@ -85,6 +86,7 @@ class is_streamable {
|
|||||||
public:
|
public:
|
||||||
static constexpr bool value = decltype(test<T>(0))::value;
|
static constexpr bool value = decltype(test<T>(0))::value;
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
|
||||||
// Formats a value.
|
// Formats a value.
|
||||||
@ -123,7 +125,9 @@ typename std::enable_if<
|
|||||||
BasicWriter<Char>&
|
BasicWriter<Char>&
|
||||||
>::type
|
>::type
|
||||||
operator<<(BasicWriter<Char> &writer, const T &value) {
|
operator<<(BasicWriter<Char> &writer, const T &value) {
|
||||||
|
#ifdef FMT_HAS_DECLTYPE_INCOMPLETE_RETURN_TYPES
|
||||||
static_assert(internal::is_streamable<T>::value, "T must be Streamable");
|
static_assert(internal::is_streamable<T>::value, "T must be Streamable");
|
||||||
|
#endif
|
||||||
|
|
||||||
auto &buffer = writer.buffer();
|
auto &buffer = writer.buffer();
|
||||||
Char *start = &buffer[0] + buffer.size();
|
Char *start = &buffer[0] + buffer.size();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user