Closed JaiganeshKumaran closed 4 months ago
This issue is stale because it has been open 10 days with no activity. Remove stale label or comment or this will be closed in 5 days.
I have this in my project.
template <typename T>
struct exclusive
{
T underlying;
winrt::impl::consume_t<T>* operator->() const noexcept
{
return &underlying;
}
};
struct multi_interface_cache
{
exclusive<IInterface1> one;
exclusive<IInterface2> two;
};
IInspectable obj = ...;
multi_interface_cache cache;
obj.as(cache.one.underlying);
obj.as(cache.two.underlying);
The exclusive
For efficiency reasons, sometimes I want to have references to all interface that I am going to use separately. However, since projected types have forwarders for methods on the required interfaces, I cannot easily tell if an implicit query was made.