mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-07 08:31:16 +00:00
Deprecate undocumented _u suffix
This commit is contained in:
parent
eafd079868
commit
153f753bde
@ -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
|
||||||
|
@ -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"),
|
||||||
|
Loading…
Reference in New Issue
Block a user