Fix MSVC build, take 2
This commit is contained in:
+2
-2
@@ -336,8 +336,8 @@ class basic_buffer {
|
||||
std::size_t capacity_;
|
||||
|
||||
protected:
|
||||
basic_buffer(T *p = FMT_NULL, std::size_t buf_size = 0, std::size_t buf_capacity = 0)
|
||||
FMT_NOEXCEPT: ptr_(p), size_(buf_size), capacity_(buf_capacity) {}
|
||||
basic_buffer(T *p = FMT_NULL, std::size_t sz = 0, std::size_t cap = 0)
|
||||
FMT_NOEXCEPT: ptr_(p), size_(sz), capacity_(cap) {}
|
||||
|
||||
/** Sets the buffer data and capacity. */
|
||||
void set(T *buf_data, std::size_t buf_capacity) FMT_NOEXCEPT {
|
||||
|
||||
@@ -169,7 +169,8 @@ FMT_END_NAMESPACE
|
||||
#endif
|
||||
|
||||
// A workaround for gcc 4.4 that doesn't support union members with ctors.
|
||||
#if FMT_GCC_VERSION && FMT_GCC_VERSION <= 404
|
||||
#if (FMT_GCC_VERSION && FMT_GCC_VERSION <= 404) || \
|
||||
(FMT_MSC_VER && FMT_MSC_VER <= 1800)
|
||||
# define FMT_UNION struct
|
||||
#else
|
||||
# define FMT_UNION union
|
||||
@@ -1553,7 +1554,7 @@ class arg_formatter_base {
|
||||
if (std::is_same<T, bool>::value) {
|
||||
if (specs_.type_)
|
||||
return (*this)(value ? 1 : 0);
|
||||
write(value);
|
||||
write(value != 0);
|
||||
} else if (std::is_same<T, char_type>::value) {
|
||||
internal::handle_char_specs(
|
||||
specs_, char_spec_handler(*this, static_cast<char_type>(value)));
|
||||
|
||||
@@ -250,8 +250,6 @@ class printf_arg_formatter:
|
||||
: base(back_insert_range<internal::basic_buffer<char_type>>(buffer), spec),
|
||||
context_(ctx) {}
|
||||
|
||||
using base::operator();
|
||||
|
||||
template <typename T>
|
||||
typename std::enable_if<std::is_integral<T>::value, iterator>::type
|
||||
operator()(T value) {
|
||||
@@ -262,7 +260,7 @@ class printf_arg_formatter:
|
||||
if (fmt_spec.type_ != 's')
|
||||
return base::operator()(value ? 1 : 0);
|
||||
fmt_spec.type_ = 0;
|
||||
this->write(value);
|
||||
this->write(value != 0);
|
||||
} else if (std::is_same<T, char_type>::value) {
|
||||
format_specs &fmt_spec = this->spec();
|
||||
if (fmt_spec.type_ && fmt_spec.type_ != 'c')
|
||||
@@ -304,6 +302,14 @@ class printf_arg_formatter:
|
||||
return this->out();
|
||||
}
|
||||
|
||||
iterator operator()(basic_string_view<char_type> value) {
|
||||
return base::operator()(value);
|
||||
}
|
||||
|
||||
iterator operator()(monostate value) {
|
||||
return base::operator()(value);
|
||||
}
|
||||
|
||||
/** Formats a pointer. */
|
||||
iterator operator()(const void *value) {
|
||||
if (value)
|
||||
|
||||
@@ -93,12 +93,14 @@ struct conditional_helper {};
|
||||
template <typename T, typename _ = void>
|
||||
struct is_range_ : std::false_type {};
|
||||
|
||||
#if !FMT_MSC_VER || FMT_MSC_VER > 1800
|
||||
template <typename T>
|
||||
struct is_range_<T,typename std::conditional<
|
||||
false,
|
||||
conditional_helper<decltype(internal::declval<T>().begin()),
|
||||
decltype(internal::declval<T>().end())>,
|
||||
void>::type> : std::true_type {};
|
||||
struct is_range_<T, typename std::conditional<
|
||||
false,
|
||||
conditional_helper<decltype(internal::declval<T>().begin()),
|
||||
decltype(internal::declval<T>().end())>,
|
||||
void>::type> : std::true_type {};
|
||||
#endif
|
||||
|
||||
/// tuple_size and tuple_element check.
|
||||
template <typename T>
|
||||
@@ -146,7 +148,7 @@ using make_index_sequence = make_integer_sequence<std::size_t, N>;
|
||||
#endif
|
||||
|
||||
template <class Tuple, class F, size_t... Is>
|
||||
void for_each(index_sequence<Is...>, Tuple &&tup, F &&f) noexcept {
|
||||
void for_each(index_sequence<Is...>, Tuple &&tup, F &&f) FMT_NOEXCEPT {
|
||||
using std::get;
|
||||
// using free function get<I>(T) now.
|
||||
const int _[] = {0, ((void)f(get<Is>(tup)), 0)...};
|
||||
|
||||
Reference in New Issue
Block a user