Deprecate undocumented _u suffix

This commit is contained in:
Victor Zverovich 2020-03-04 19:20:19 -08:00
parent eafd079868
commit 153f753bde
2 changed files with 2 additions and 13 deletions

View File

@ -566,7 +566,8 @@ class FMT_DEPRECATED u8string_view : public basic_string_view<char8_t> {
#if FMT_USE_USER_DEFINED_LITERALS #if FMT_USE_USER_DEFINED_LITERALS
inline namespace literals { inline namespace literals {
inline basic_string_view<char8_t> operator"" _u(const char* s, std::size_t n) { FMT_DEPRECATED inline basic_string_view<char8_t> operator"" _u(const char* s,
std::size_t n) {
return {reinterpret_cast<const char8_t*>(s), n}; return {reinterpret_cast<const char8_t*>(s), n};
} }
} // namespace literals } // namespace literals

View File

@ -2523,18 +2523,6 @@ std::string from_u8str(const fmt::basic_string_view<char8_t>& str) {
return std::string(str.begin(), str.end()); return std::string(str.begin(), str.end());
} }
#if FMT_USE_USER_DEFINED_LITERALS
TEST(FormatTest, U8StringViewLiteral) {
using namespace fmt::literals;
fmt::basic_string_view<char8_t> s = "ab"_u;
EXPECT_EQ(s.size(), 2u);
const char8_t* data = s.data();
EXPECT_EQ(char(data[0]), 'a');
EXPECT_EQ(char(data[1]), 'b');
EXPECT_EQ(from_u8str(format("{:*^5}"_u, "🤡"_u)), from_u8str("**🤡**"_u));
}
#endif
TEST(FormatTest, EmphasisNonHeaderOnly) { TEST(FormatTest, EmphasisNonHeaderOnly) {
// Ensure this compiles even if FMT_HEADER_ONLY is not defined. // Ensure this compiles even if FMT_HEADER_ONLY is not defined.
EXPECT_EQ(fmt::format(fmt::emphasis::bold, "bold error"), EXPECT_EQ(fmt::format(fmt::emphasis::bold, "bold error"),