Ability to join elements of std::initializer_list was added

This commit is contained in:
Nikolay Rapotkin
2020-03-13 11:20:24 +03:00
committed by Victor Zverovich
parent ff486a72a7
commit 85050aa2e6
2 changed files with 30 additions and 0 deletions

View File

@@ -70,6 +70,12 @@ TEST(RangesTest, JoinTuple) {
EXPECT_EQ("4.0", fmt::format("{}", fmt::join(t4, "/")));
}
TEST(RangesTest, JoinInitializerList) {
EXPECT_EQ("1, 2, 3", fmt::format("{}", fmt::join({1, 2, 3}, ", ")));
EXPECT_EQ("fmt rocks !",
fmt::format("{}", fmt::join({"fmt", "rocks", "!"}, " ")));
}
struct my_struct {
int32_t i;
std::string str; // can throw