mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-02 11:28:20 +00:00
Use correct capacity in iterator_buffer (#1807)
This commit is contained in:
parent
d0dd678693
commit
065889a593
@ -771,7 +771,7 @@ class iterator_buffer : public Traits, public buffer<T> {
|
||||
void flush();
|
||||
|
||||
public:
|
||||
explicit iterator_buffer(OutputIt out, size_t n = 0)
|
||||
explicit iterator_buffer(OutputIt out, size_t n = buffer_size)
|
||||
: Traits(n),
|
||||
buffer<T>(data_, 0, n < size_t(buffer_size) ? n : size_t(buffer_size)),
|
||||
out_(out) {}
|
||||
|
@ -1946,6 +1946,12 @@ TEST(FormatTest, FormattedSize) {
|
||||
EXPECT_EQ(2u, fmt::formatted_size("{}", 42));
|
||||
}
|
||||
|
||||
TEST(FormatTest, FormatTo) {
|
||||
std::vector<char> v;
|
||||
fmt::format_to(std::back_inserter(v), "{}", "foo");
|
||||
EXPECT_EQ(string_view(v.data(), v.size()), "foo");
|
||||
}
|
||||
|
||||
TEST(FormatTest, FormatToN) {
|
||||
char buffer[4];
|
||||
buffer[3] = 'x';
|
||||
|
Loading…
Reference in New Issue
Block a user