diff --git a/include/fmt/compile.h b/include/fmt/compile.h index 0c37adc4..9ec15474 100644 --- a/include/fmt/compile.h +++ b/include/fmt/compile.h @@ -378,8 +378,7 @@ template struct text { template OutputIt format(OutputIt out, const Args&...) const { - // TODO: reserve - return copy_str(data.begin(), data.end(), out); + return write(out, data); } }; diff --git a/test/compile-test.cc b/test/compile-test.cc index e17e07db..83f8327c 100644 --- a/test/compile-test.cc +++ b/test/compile-test.cc @@ -155,4 +155,8 @@ TEST(CompileTest, FormatDefault) { EXPECT_EQ("foo", fmt::format(FMT_COMPILE("{}"), "foo")); EXPECT_EQ("foo", fmt::format(FMT_COMPILE("{}"), std::string("foo"))); } + +TEST(CompileTest, TextAndArg) { + EXPECT_EQ(">>>42<<<", fmt::format(FMT_COMPILE(">>>{}<<<"), 42)); +} #endif