Skip to content

Commit

Permalink
Implement LWG-3944 Formatters converting sequences of char to seque…
Browse files Browse the repository at this point in the history
…nces of `wchar_t` (#4784)
  • Loading branch information
frederick-vs-ja authored Jul 5, 2024
1 parent 184ce39 commit 4bffb54
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
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

0 comments on commit 4bffb54

Please sign in to comment.