Deprecated initializer_list join

This commit is contained in:
Victor Zverovich 2026-03-05 16:32:50 -08:00
parent 282b68cbd7
commit d38881410a
4 changed files with 2 additions and 9 deletions

View File

@ -844,7 +844,7 @@ FMT_CONSTEXPR auto join(const Tuple& tuple FMT_LIFETIMEBOUND, string_view sep)
* // Output: "1, 2, 3"
*/
template <typename T>
auto join(std::initializer_list<T> list, string_view sep)
FMT_DEPRECATED auto join(std::initializer_list<T> list, string_view sep)
-> join_view<const T*, const T*> {
return join(std::begin(list), std::end(list), sep);
}

View File

@ -160,7 +160,7 @@ auto join(Range&& range, S&& sep)
}
template <typename T>
auto join(std::initializer_list<T> list, wstring_view sep)
FMT_DEPRECATED auto join(std::initializer_list<T> list, wstring_view sep)
-> join_view<const T*, const T*, wchar_t> {
return join(std::begin(list), std::end(list), sep);
}

View File

@ -433,12 +433,6 @@ TEST(ranges_test, join_tuple) {
#endif
}
TEST(ranges_test, join_initializer_list) {
EXPECT_EQ(fmt::format("{}", fmt::join({1, 2, 3}, ", ")), "1, 2, 3");
EXPECT_EQ(fmt::format("{}", fmt::join({"fmt", "rocks", "!"}, " ")),
"fmt rocks !");
}
struct zstring_sentinel {};
bool operator==(const char* p, zstring_sentinel) { return *p == '\0'; }

View File

@ -174,7 +174,6 @@ TEST(xchar_test, join) {
EXPECT_EQ(fmt::format(u"({})", fmt::join(vector, u", ")), u"(1, 2, 3)");
EXPECT_EQ(fmt::format(U"({})", fmt::join(vector, U", ")), U"(1, 2, 3)");
EXPECT_EQ(fmt::format(L"({})", fmt::join(vector, L", ")), L"(1, 2, 3)");
EXPECT_EQ(fmt::format(L"({})", fmt::join({1, 2, 3}, L", ")), L"(1, 2, 3)");
auto tuple_char16 = std::tuple<char16_t, int, float>(u'a', 1, 2.0f);
EXPECT_EQ(fmt::format(u"({})", fmt::join(tuple_char16, u", ")), u"(a, 1, 2)");
auto tuple_char32 = std::tuple<char32_t, int, float>(U'a', 1, 2.0f);