mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-06 04:00:08 +00:00
ComSmartPtr: Allow compilation on VS2015
This commit is contained in:
parent
4454015812
commit
feb9ebb485
1 changed files with 17 additions and 17 deletions
|
|
@ -200,29 +200,29 @@ template <class... ComClasses>
|
|||
class ComBaseClassHelper : public ComBaseClassHelperBase<ComClasses...>
|
||||
{
|
||||
public:
|
||||
ComBaseClassHelper (unsigned int initialRefCount = 1) : ComBaseClassHelperBase<ComClasses...> (initialRefCount) {}
|
||||
explicit ComBaseClassHelper (unsigned int initialRefCount = 1)
|
||||
: ComBaseClassHelperBase<ComClasses...> (initialRefCount) {}
|
||||
|
||||
JUCE_COMRESULT QueryInterface (REFIID refId, void** result)
|
||||
{
|
||||
return queryInterfaceWithType (refId, result, Tag<ComClasses>{}...);
|
||||
}
|
||||
const std::tuple<REFIID, void*> bases[]
|
||||
{
|
||||
std::make_tuple (__uuidof (ComClasses),
|
||||
static_cast<void*> (static_cast<ComClasses*> (this)))...
|
||||
};
|
||||
|
||||
for (const auto& base : bases)
|
||||
{
|
||||
if (refId == std::get<0> (base))
|
||||
{
|
||||
this->AddRef();
|
||||
*result = std::get<1> (base);
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
JUCE_COMRESULT queryInterfaceWithType (REFIID refId, void** result)
|
||||
{
|
||||
return ComBaseClassHelperBase<ComClasses...>::QueryInterface (refId, result);
|
||||
}
|
||||
|
||||
template <typename S> struct Tag {};
|
||||
|
||||
template <typename T, typename... Ts>
|
||||
JUCE_COMRESULT queryInterfaceWithType (REFIID refId, void** result, Tag<T>, Tag<Ts>...)
|
||||
{
|
||||
if (refId == __uuidof (T))
|
||||
return this->template castToType<T> (result);
|
||||
|
||||
return queryInterfaceWithType (refId, result, Tag<Ts>{}...);
|
||||
}
|
||||
};
|
||||
|
||||
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue