mirror of
https://github.com/fmtlib/fmt.git
synced 2025-11-02 23:21:45 +01:00
Add support for arbitrary output iterators
This commit is contained in:
@@ -1910,8 +1910,11 @@ TEST(FormatTest, ToString) {
|
||||
EXPECT_EQ("42", fmt::to_string(42));
|
||||
}
|
||||
|
||||
TEST(WriterTest, NoncontiguousIterator) {
|
||||
TEST(WriterTest, OutputIterators) {
|
||||
std::list<char> out;
|
||||
fmt::format_to(std::back_inserter(out), "{}", 42);
|
||||
EXPECT_EQ("42", std::string(out.begin(), out.end()));
|
||||
std::stringstream s;
|
||||
fmt::format_to(std::ostream_iterator<char>(s), "{}", 42);
|
||||
EXPECT_EQ("42", s.str());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user