diff --git a/cppwinrt/code_writers.h b/cppwinrt/code_writers.h index 51c77a156..9bed6b968 100644 --- a/cppwinrt/code_writers.h +++ b/cppwinrt/code_writers.h @@ -3248,19 +3248,12 @@ struct __declspec(empty_bases) produce_dispatch_to_overridable type); } - static void write_namespace_special(writer& w, std::string_view const& namespace_name, cache const& c) + static void write_namespace_special(writer& w, std::string_view const& namespace_name) { if (namespace_name == "Windows.Foundation") { - if (c.find("Windows.Foundation.PropertyValue")) - { - w.write(strings::base_reference_produce); - } - if (c.find("Windows.Foundation.Deferral")) - { - w.write(strings::base_deferral); - } - + w.write(strings::base_reference_produce); + w.write(strings::base_deferral); w.write(strings::base_coroutine_foundation); } else if (namespace_name == "Windows.Foundation.Collections") @@ -3292,4 +3285,12 @@ struct __declspec(empty_bases) produce_dispatch_to_overridable w.write(strings::base_xaml_typename); } } + + static void write_namespace_special_1(writer& w, std::string_view const& namespace_name) + { + if (namespace_name == "Windows.Foundation") + { + w.write(strings::base_reference_produce_1); + } + } } diff --git a/cppwinrt/cppwinrt.vcxproj b/cppwinrt/cppwinrt.vcxproj index 73a5288ec..054dfaf73 100644 --- a/cppwinrt/cppwinrt.vcxproj +++ b/cppwinrt/cppwinrt.vcxproj @@ -75,6 +75,7 @@ + diff --git a/cppwinrt/cppwinrt.vcxproj.filters b/cppwinrt/cppwinrt.vcxproj.filters index 7caab56a8..26c1fdafd 100644 --- a/cppwinrt/cppwinrt.vcxproj.filters +++ b/cppwinrt/cppwinrt.vcxproj.filters @@ -115,6 +115,9 @@ strings + + strings + strings diff --git a/cppwinrt/file_writers.h b/cppwinrt/file_writers.h index c91b1de91..8dfd6f09d 100644 --- a/cppwinrt/file_writers.h +++ b/cppwinrt/file_writers.h @@ -127,6 +127,7 @@ namespace cppwinrt auto wrap_type = wrap_type_namespace(w, ns); w.write_each(members.interfaces); } + write_namespace_special_1(w, ns); write_close_file_guard(w); w.swap(); @@ -201,7 +202,7 @@ namespace cppwinrt w.write_each(members.classes); } - write_namespace_special(w, ns, c); + write_namespace_special(w, ns); write_close_file_guard(w); w.swap(); diff --git a/strings/base_reference_produce.h b/strings/base_reference_produce.h index 8228cbc4c..1965efc7a 100644 --- a/strings/base_reference_produce.h +++ b/strings/base_reference_produce.h @@ -397,35 +397,7 @@ namespace winrt::impl static auto make(array_view const& value) { return Windows::Foundation::PropertyValue::CreateRectArray(value); } using itf = Windows::Foundation::IReferenceArray; }; -} - -WINRT_EXPORT namespace winrt::Windows::Foundation -{ - template - bool operator==(IReference const& left, IReference const& right) - { - if (get_abi(left) == get_abi(right)) - { - return true; - } - - if (!left || !right) - { - return false; - } - return left.Value() == right.Value(); - } - - template - bool operator!=(IReference const& left, IReference const& right) - { - return !(left == right); - } -} - -namespace winrt::impl -{ template T unbox_value_type(From&& value) { diff --git a/strings/base_reference_produce_1.h b/strings/base_reference_produce_1.h new file mode 100644 index 000000000..7c5143821 --- /dev/null +++ b/strings/base_reference_produce_1.h @@ -0,0 +1,25 @@ + +WINRT_EXPORT namespace winrt::Windows::Foundation +{ + template + bool operator==(IReference const& left, IReference const& right) + { + if (get_abi(left) == get_abi(right)) + { + return true; + } + + if (!left || !right) + { + return false; + } + + return left.Value() == right.Value(); + } + + template + bool operator!=(IReference const& left, IReference const& right) + { + return !(left == right); + } +}