mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-24 12:14:26 +00:00
Reduce library size
This commit is contained in:
parent
4a617f25c6
commit
b1af642d1d
@ -1666,20 +1666,16 @@ template <typename Range> class basic_writer {
|
|||||||
size_t num_code_points = width != 0 ? f.width() : size;
|
size_t num_code_points = width != 0 ? f.width() : size;
|
||||||
if (width <= num_code_points) return f(reserve(size));
|
if (width <= num_code_points) return f(reserve(size));
|
||||||
size_t padding = width - num_code_points;
|
size_t padding = width - num_code_points;
|
||||||
size_t fill_size = specs.fill.size();
|
size_t left_padding = 0;
|
||||||
auto&& it = reserve(size + padding * fill_size);
|
if (specs.align == align::right)
|
||||||
if (specs.align == align::right) {
|
left_padding = padding;
|
||||||
it = fill(it, padding, specs.fill);
|
else if (specs.align == align::center)
|
||||||
f(it);
|
left_padding = padding / 2;
|
||||||
} else if (specs.align == align::center) {
|
auto&& it = reserve(size + padding * specs.fill.size());
|
||||||
std::size_t left_padding = padding / 2;
|
it = fill(it, left_padding, specs.fill);
|
||||||
it = fill(it, left_padding, specs.fill);
|
// Dummy check to workaround a bug in MSVC2017.
|
||||||
f(it);
|
if (const_check(true)) f(it);
|
||||||
it = fill(it, padding - left_padding, specs.fill);
|
it = fill(it, padding - left_padding, specs.fill);
|
||||||
} else {
|
|
||||||
f(it);
|
|
||||||
it = fill(it, padding, specs.fill);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void write(int value) { write_decimal(value); }
|
void write(int value) { write_decimal(value); }
|
||||||
|
Loading…
Reference in New Issue
Block a user