explicit capture to avoid MACRO

This commit is contained in:
Markus Werle 2020-05-09 17:55:44 +02:00
parent 9f8cacb8a4
commit 393fd86ab9

View File

@ -172,12 +172,6 @@ FMT_END_NAMESPACE
# define FMT_BUILTIN_CLZLL(n) __builtin_clzll(n) # define FMT_BUILTIN_CLZLL(n) __builtin_clzll(n)
#endif #endif
#if (__cplusplus > 201703L)
# define FMT_CAPTURE_THIS , this
#else
# define FMT_CAPTURE_THIS
#endif
// Some compilers masquerade as both MSVC and GCC-likes or otherwise support // Some compilers masquerade as both MSVC and GCC-likes or otherwise support
// __builtin_clz and __builtin_clzll, so only define FMT_BUILTIN_CLZ using the // __builtin_clz and __builtin_clzll, so only define FMT_BUILTIN_CLZ using the
// MSVC intrinsics if the clz and clzll builtins are not available. // MSVC intrinsics if the clz and clzll builtins are not available.
@ -1474,7 +1468,7 @@ template <typename OutputIt, typename Char, typename UInt> struct int_writer {
void on_dec() { void on_dec() {
auto num_digits = count_digits(abs_value); auto num_digits = count_digits(abs_value);
out = write_int(out, num_digits, get_prefix(), specs, out = write_int(out, num_digits, get_prefix(), specs,
[= FMT_CAPTURE_THIS](iterator it) { [this, num_digits](iterator it) {
return format_decimal<Char>(it, abs_value, num_digits); return format_decimal<Char>(it, abs_value, num_digits);
}); });
} }
@ -1486,7 +1480,7 @@ template <typename OutputIt, typename Char, typename UInt> struct int_writer {
} }
int num_digits = count_digits<4>(abs_value); int num_digits = count_digits<4>(abs_value);
out = write_int(out, num_digits, get_prefix(), specs, out = write_int(out, num_digits, get_prefix(), specs,
[= FMT_CAPTURE_THIS](iterator it) { [this, num_digits](iterator it) {
return format_uint<4, Char>(it, abs_value, num_digits, return format_uint<4, Char>(it, abs_value, num_digits,
specs.type != 'x'); specs.type != 'x');
}); });
@ -1499,7 +1493,7 @@ template <typename OutputIt, typename Char, typename UInt> struct int_writer {
} }
int num_digits = count_digits<1>(abs_value); int num_digits = count_digits<1>(abs_value);
out = write_int(out, num_digits, get_prefix(), specs, out = write_int(out, num_digits, get_prefix(), specs,
[= FMT_CAPTURE_THIS](iterator it) { [this, num_digits](iterator it) {
return format_uint<1, Char>(it, abs_value, num_digits); return format_uint<1, Char>(it, abs_value, num_digits);
}); });
} }
@ -1512,7 +1506,7 @@ template <typename OutputIt, typename Char, typename UInt> struct int_writer {
prefix[prefix_size++] = '0'; prefix[prefix_size++] = '0';
} }
out = write_int(out, num_digits, get_prefix(), specs, out = write_int(out, num_digits, get_prefix(), specs,
[= FMT_CAPTURE_THIS](iterator it) { [this, num_digits](iterator it) {
return format_uint<3, Char>(it, abs_value, num_digits); return format_uint<3, Char>(it, abs_value, num_digits);
}); });
} }