mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-31 11:17:35 +02:00
Fix MinGW build
This commit is contained in:
19
fmt/format.h
19
fmt/format.h
@ -1513,15 +1513,16 @@ constexpr uint64_t make_type<void>() { return 0; }
|
|||||||
// Maximum number of arguments with packed types.
|
// Maximum number of arguments with packed types.
|
||||||
enum { MAX_PACKED_ARGS = 16 };
|
enum { MAX_PACKED_ARGS = 16 };
|
||||||
|
|
||||||
template <bool PACKED, typename Context, typename T>
|
template <bool IS_PACKED, typename Context, typename T>
|
||||||
inline typename std::enable_if<PACKED, Value<typename Context::char_type>>::type
|
inline typename std::enable_if<
|
||||||
|
IS_PACKED, Value<typename Context::char_type>>::type
|
||||||
make_arg(const T& value) {
|
make_arg(const T& value) {
|
||||||
return MakeValue<Context>(value);
|
return MakeValue<Context>(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <bool PACKED, typename Context, typename T>
|
template <bool IS_PACKED, typename Context, typename T>
|
||||||
inline typename std::enable_if<
|
inline typename std::enable_if<
|
||||||
!PACKED, basic_format_arg<typename Context::char_type>>::type
|
!IS_PACKED, basic_format_arg<typename Context::char_type>>::type
|
||||||
make_arg(const T& value) {
|
make_arg(const T& value) {
|
||||||
return MakeArg<Context>(value);
|
return MakeArg<Context>(value);
|
||||||
}
|
}
|
||||||
@ -1531,22 +1532,24 @@ template <typename Context, typename ...Args>
|
|||||||
class format_arg_store {
|
class format_arg_store {
|
||||||
private:
|
private:
|
||||||
static const size_t NUM_ARGS = sizeof...(Args);
|
static const size_t NUM_ARGS = sizeof...(Args);
|
||||||
static const bool PACKED = NUM_ARGS < internal::MAX_PACKED_ARGS;
|
|
||||||
|
// Packed is a macro on MinGW so use IS_PACKED instead.
|
||||||
|
static const bool IS_PACKED = NUM_ARGS < internal::MAX_PACKED_ARGS;
|
||||||
|
|
||||||
typedef typename Context::char_type char_type;
|
typedef typename Context::char_type char_type;
|
||||||
|
|
||||||
typedef typename std::conditional<PACKED,
|
typedef typename std::conditional<IS_PACKED,
|
||||||
internal::Value<char_type>, basic_format_arg<char_type>>::type value_type;
|
internal::Value<char_type>, basic_format_arg<char_type>>::type value_type;
|
||||||
|
|
||||||
// If the arguments are not packed, add one more element to mark the end.
|
// If the arguments are not packed, add one more element to mark the end.
|
||||||
typedef std::array<value_type, NUM_ARGS + (PACKED ? 0 : 1)> Array;
|
typedef std::array<value_type, NUM_ARGS + (IS_PACKED ? 0 : 1)> Array;
|
||||||
Array data_;
|
Array data_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const uint64_t TYPES = internal::make_type<Args..., void>();
|
static const uint64_t TYPES = internal::make_type<Args..., void>();
|
||||||
|
|
||||||
format_arg_store(const Args &... args)
|
format_arg_store(const Args &... args)
|
||||||
: data_(Array{internal::make_arg<PACKED, Context>(args)...}) {}
|
: data_(Array{internal::make_arg<IS_PACKED, Context>(args)...}) {}
|
||||||
|
|
||||||
const value_type *data() const { return data_.data(); }
|
const value_type *data() const { return data_.data(); }
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user