Skip to content

Commit f88c039

Browse files
committed
add operator<< for char16_t, wchar_t
used in test_convert
1 parent e030a30 commit f88c039

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@
1313
*.so
1414
*.o
1515
*.a
16+
/include-what-you-use
17+
/build*/

test/test.hpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,26 @@ std::ostream& operator<<(std::ostream& os, std::basic_string_view<Char, Traits>
4242
return print_sequence(os, string_view, "''");
4343
}
4444

45+
inline std::ostream& operator<<(std::ostream& os, char16_t ch)
46+
{
47+
return os << static_cast<int64_t>(ch);
48+
}
49+
50+
inline std::ostream& operator<<(std::ostream& os, char16_t const* str)
51+
{
52+
return print_sequence(os, std::basic_string_view<char16_t>(str), "''");
53+
}
54+
55+
inline std::ostream& operator<<(std::ostream& os, wchar_t ch)
56+
{
57+
return os << static_cast<int64_t>(ch);
58+
}
59+
60+
inline std::ostream& operator<<(std::ostream& os, wchar_t const* str)
61+
{
62+
return print_sequence(os, std::basic_string_view<wchar_t>(str), "''");
63+
}
64+
4565
template<typename T, typename Alloc>
4666
std::ostream& operator<<(std::ostream& os, std::vector<T, Alloc> const& vector)
4767
{

0 commit comments

Comments
 (0)