Skip to content
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
3 changes: 2 additions & 1 deletion cppwinrt/code_writers.h
Original file line number Diff line number Diff line change
Expand Up @@ -3259,6 +3259,7 @@ struct __declspec(empty_bases) produce_dispatch_to_overridable<T, D, %>
w.write(strings::base_reference_produce);
w.write(strings::base_deferral);
w.write(strings::base_coroutine_foundation);
w.write(strings::base_stringable_format);
}
else if (namespace_name == "Windows.Foundation.Collections")
{
Expand Down Expand Up @@ -3295,7 +3296,7 @@ struct __declspec(empty_bases) produce_dispatch_to_overridable<T, D, %>
if (namespace_name == "Windows.Foundation")
{
w.write(strings::base_reference_produce_1);
w.write(strings::base_stringable_format);
w.write(strings::base_stringable_format_1);
}
}
}
3 changes: 2 additions & 1 deletion cppwinrt/cppwinrt.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,10 @@
<ClInclude Include="..\strings\base_security.h" />
<ClInclude Include="..\strings\base_std_hash.h" />
<ClInclude Include="..\strings\base_string.h" />
<ClInclude Include="..\strings\base_stringable_format.h" />
<ClInclude Include="..\strings\base_string_input.h" />
<ClInclude Include="..\strings\base_string_operators.h" />
<ClInclude Include="..\strings\base_stringable_format.h" />
<ClInclude Include="..\strings\base_stringable_format_1.h" />
<ClInclude Include="..\strings\base_types.h" />
<ClInclude Include="..\strings\base_version.h" />
<ClInclude Include="..\strings\base_version_odr.h" />
Expand Down
3 changes: 3 additions & 0 deletions cppwinrt/cppwinrt.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@
<ClInclude Include="..\strings\base_iterator.h">
<Filter>strings</Filter>
</ClInclude>
<ClInclude Include="..\strings\base_stringable_format_1.h">
<Filter>strings</Filter>
</ClInclude>
<ClInclude Include="..\strings\base_stringable_format.h">
<Filter>strings</Filter>
</ClInclude>
Expand Down
12 changes: 4 additions & 8 deletions strings/base_stringable_format.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@

#ifdef __cpp_lib_format
template<>
struct std::formatter<winrt::Windows::Foundation::IStringable, wchar_t> : std::formatter<winrt::hstring, wchar_t>
template <typename FormatContext>
auto std::formatter<winrt::Windows::Foundation::IStringable, wchar_t>::format(winrt::Windows::Foundation::IStringable const& obj, FormatContext& fc)
{
template<typename FormatContext>
auto format(winrt::Windows::Foundation::IStringable const& obj, FormatContext& fc)
{
return std::formatter<winrt::hstring, wchar_t>::format(obj.ToString(), fc);
}
};
return std::formatter<winrt::hstring, wchar_t>::format(obj.ToString(), fc);
}
#endif
9 changes: 9 additions & 0 deletions strings/base_stringable_format_1.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

#ifdef __cpp_lib_format
template <>
struct std::formatter<winrt::Windows::Foundation::IStringable, wchar_t> : std::formatter<winrt::hstring, wchar_t>
{
template <typename FormatContext>
auto format(winrt::Windows::Foundation::IStringable const& obj, FormatContext& fc);
};
#endif