Skip to content

Commit d4d5733

Browse files
committed
Add back reference to structured binding to re-eliminate spurious addref/release that is increasing binary size
1 parent 08f23ea commit d4d5733

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cppwinrt/code_writers.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,7 +1137,7 @@ namespace cppwinrt
11371137
{%
11381138
if constexpr (!std::is_same_v<D, %>)
11391139
{
1140-
auto const [castedResult, code] = static_cast<D const*>(this)->template try_as_with_reason<%>();
1140+
auto const& [castedResult, code] = static_cast<D const*>(this)->template try_as_with_reason<%>();
11411141
check_hresult(code);
11421142
auto const abiType = *(abi_t<%>**)&castedResult;
11431143
abiType->%(%);
@@ -1156,7 +1156,7 @@ namespace cppwinrt
11561156
{%
11571157
if constexpr (!std::is_same_v<D, %>)
11581158
{
1159-
auto const [castedResult, code] = static_cast<D const*>(this)->template try_as_with_reason<%>();
1159+
auto const& [castedResult, code] = static_cast<D const*>(this)->template try_as_with_reason<%>();
11601160
check_hresult(code);
11611161
auto const abiType = *(abi_t<%>**)&castedResult;
11621162
WINRT_VERIFY_(0, abiType->%(%));
@@ -1176,7 +1176,7 @@ namespace cppwinrt
11761176
{%
11771177
if constexpr (!std::is_same_v<D, %>)
11781178
{
1179-
auto const [castedResult, code] = static_cast<D const*>(this)->template try_as_with_reason<%>();
1179+
auto const& [castedResult, code] = static_cast<D const*>(this)->template try_as_with_reason<%>();
11801180
check_hresult(code);
11811181
auto const abiType = *(abi_t<%>**)&castedResult;
11821182
check_hresult(abiType->%(%));

0 commit comments

Comments
 (0)