diff --git a/cppwinrt/code_writers.h b/cppwinrt/code_writers.h index c369eb98c..9d4b98e23 100644 --- a/cppwinrt/code_writers.h +++ b/cppwinrt/code_writers.h @@ -3259,6 +3259,7 @@ struct __declspec(empty_bases) produce_dispatch_to_overridable 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") { @@ -3295,7 +3296,7 @@ struct __declspec(empty_bases) produce_dispatch_to_overridable 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); } } } diff --git a/cppwinrt/cppwinrt.vcxproj b/cppwinrt/cppwinrt.vcxproj index 71272d14f..258feafc6 100644 --- a/cppwinrt/cppwinrt.vcxproj +++ b/cppwinrt/cppwinrt.vcxproj @@ -79,9 +79,10 @@ + - + diff --git a/cppwinrt/cppwinrt.vcxproj.filters b/cppwinrt/cppwinrt.vcxproj.filters index bfd56434a..dfe1488ee 100644 --- a/cppwinrt/cppwinrt.vcxproj.filters +++ b/cppwinrt/cppwinrt.vcxproj.filters @@ -169,6 +169,9 @@ strings + + strings + strings diff --git a/strings/base_stringable_format.h b/strings/base_stringable_format.h index 41a54dfd4..86c5acfc6 100644 --- a/strings/base_stringable_format.h +++ b/strings/base_stringable_format.h @@ -1,12 +1,8 @@ #ifdef __cpp_lib_format -template<> -struct std::formatter : std::formatter +template +auto std::formatter::format(winrt::Windows::Foundation::IStringable const& obj, FormatContext& fc) { - template - auto format(winrt::Windows::Foundation::IStringable const& obj, FormatContext& fc) - { - return std::formatter::format(obj.ToString(), fc); - } -}; + return std::formatter::format(obj.ToString(), fc); +} #endif diff --git a/strings/base_stringable_format_1.h b/strings/base_stringable_format_1.h new file mode 100644 index 000000000..6a7becdfc --- /dev/null +++ b/strings/base_stringable_format_1.h @@ -0,0 +1,9 @@ + +#ifdef __cpp_lib_format +template <> +struct std::formatter : std::formatter +{ + template + auto format(winrt::Windows::Foundation::IStringable const& obj, FormatContext& fc); +}; +#endif