mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-19 11:14:41 +00:00
Make appender compatible with fill
This commit is contained in:
parent
447c6cbf44
commit
de684ef776
@ -106,6 +106,13 @@
|
||||
# define FMT_NOINLINE
|
||||
#endif
|
||||
|
||||
namespace std {
|
||||
template <> struct iterator_traits<fmt::appender> {
|
||||
using iterator_category = output_iterator_tag;
|
||||
using value_type = char;
|
||||
};
|
||||
} // namespace std
|
||||
|
||||
#ifndef FMT_THROW
|
||||
# if FMT_EXCEPTIONS
|
||||
# if FMT_MSC_VERSION || defined(__NVCC__)
|
||||
|
@ -2057,6 +2057,13 @@ TEST(format_test, output_iterators) {
|
||||
EXPECT_EQ("42", s.str());
|
||||
}
|
||||
|
||||
TEST(format_test, fill_via_appender) {
|
||||
fmt::memory_buffer buf;
|
||||
auto it = fmt::appender(buf);
|
||||
std::fill_n(it, 3, '~');
|
||||
EXPECT_EQ(fmt::to_string(buf), "~~~");
|
||||
}
|
||||
|
||||
TEST(format_test, formatted_size) {
|
||||
EXPECT_EQ(2u, fmt::formatted_size("{}", 42));
|
||||
EXPECT_EQ(2u, fmt::formatted_size(std::locale(), "{}", 42));
|
||||
|
Loading…
Reference in New Issue
Block a user