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))
|
||||
#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
|
||||
// If header only do not use extern templates.
|
||||
# undef FMT_USE_EXTERN_TEMPLATES
|
||||
|
||||
@ -74,6 +74,7 @@ struct ConvertToIntImpl<T, true> {
|
||||
// Write the content of w to os.
|
||||
void write(std::ostream &os, Writer &w);
|
||||
|
||||
#ifdef FMT_HAS_DECLTYPE_INCOMPLETE_RETURN_TYPES
|
||||
template<typename T>
|
||||
class is_streamable {
|
||||
template<typename U>
|
||||
@ -85,6 +86,7 @@ class is_streamable {
|
||||
public:
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
#endif
|
||||
} // namespace internal
|
||||
|
||||
// Formats a value.
|
||||
@ -123,7 +125,9 @@ typename std::enable_if<
|
||||
BasicWriter<Char>&
|
||||
>::type
|
||||
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");
|
||||
#endif
|
||||
|
||||
auto &buffer = writer.buffer();
|
||||
Char *start = &buffer[0] + buffer.size();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user