Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement LWG-3944 Formatters converting sequences of char to sequences of wchar_t #4784

Merged
merged 1 commit into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions stl/inc/__msvc_formatter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,41 @@ struct formatter<basic_string_view<_CharT, _Traits>, _CharT>
};

#if _HAS_CXX23
template <>
struct formatter<char*, wchar_t> {
formatter() = delete;
formatter(const formatter&) = delete;
formatter& operator=(const formatter&) = delete;
};

template <>
struct formatter<const char*, wchar_t> {
formatter() = delete;
formatter(const formatter&) = delete;
formatter& operator=(const formatter&) = delete;
};

template <size_t _Size>
struct formatter<char[_Size], wchar_t> {
formatter() = delete;
formatter(const formatter&) = delete;
formatter& operator=(const formatter&) = delete;
};

template <class _Traits, class _Allocator>
struct formatter<basic_string<char, _Traits, _Allocator>, wchar_t> {
formatter() = delete;
formatter(const formatter&) = delete;
formatter& operator=(const formatter&) = delete;
};

template <class _Traits>
struct formatter<basic_string_view<char, _Traits>, wchar_t> {
formatter() = delete;
formatter(const formatter&) = delete;
formatter& operator=(const formatter&) = delete;
};

_EXPORT_STD enum class range_format { disabled, map, set, sequence, string, debug_string };

template <class _Ty>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,11 @@ enum class ec { a };
template <class CharT>
void test_disabled() {
if constexpr (!same_as<CharT, char>) {
assert_is_not_formattable<char*, CharT>();
assert_is_not_formattable<const char*, CharT>();
assert_is_not_formattable<char[42], CharT>();
assert_is_not_formattable<string, CharT>();
assert_is_not_formattable<string_view, CharT>();
}

assert_is_not_formattable<c, CharT>();
Expand Down