Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make implicit capture explicit for C++20 #1669

Merged
merged 5 commits into from
May 9, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -1467,9 +1467,10 @@ template <typename OutputIt, typename Char, typename UInt> struct int_writer {

void on_dec() {
auto num_digits = count_digits(abs_value);
out = write_int(out, num_digits, get_prefix(), specs, [=](iterator it) {
return format_decimal<Char>(it, abs_value, num_digits);
});
out = write_int(out, num_digits, get_prefix(), specs,
[this, num_digits](iterator it) {
return format_decimal<Char>(it, abs_value, num_digits);
});
}

void on_hex() {
Expand All @@ -1478,9 +1479,11 @@ template <typename OutputIt, typename Char, typename UInt> struct int_writer {
prefix[prefix_size++] = specs.type;
}
int num_digits = count_digits<4>(abs_value);
out = write_int(out, num_digits, get_prefix(), specs, [=](iterator it) {
return format_uint<4, Char>(it, abs_value, num_digits, specs.type != 'x');
});
out = write_int(out, num_digits, get_prefix(), specs,
[this, num_digits](iterator it) {
return format_uint<4, Char>(it, abs_value, num_digits,
specs.type != 'x');
});
}

void on_bin() {
Expand All @@ -1489,9 +1492,10 @@ template <typename OutputIt, typename Char, typename UInt> struct int_writer {
prefix[prefix_size++] = static_cast<char>(specs.type);
}
int num_digits = count_digits<1>(abs_value);
out = write_int(out, num_digits, get_prefix(), specs, [=](iterator it) {
return format_uint<1, Char>(it, abs_value, num_digits);
});
out = write_int(out, num_digits, get_prefix(), specs,
[this, num_digits](iterator it) {
return format_uint<1, Char>(it, abs_value, num_digits);
});
}

void on_oct() {
Expand All @@ -1501,9 +1505,10 @@ template <typename OutputIt, typename Char, typename UInt> struct int_writer {
// is not greater than the number of digits.
prefix[prefix_size++] = '0';
}
out = write_int(out, num_digits, get_prefix(), specs, [=](iterator it) {
return format_uint<3, Char>(it, abs_value, num_digits);
});
out = write_int(out, num_digits, get_prefix(), specs,
[this, num_digits](iterator it) {
return format_uint<3, Char>(it, abs_value, num_digits);
});
}

enum { sep_size = 1 };
Expand Down