mirror of
https://github.com/KhronosGroup/Vulkan-Hpp
synced 2024-11-26 22:00:08 +00:00
30 lines
714 B
C++
30 lines
714 B
C++
|
template <typename OwnerType, typename Dispatch>
|
||
|
class ObjectRelease
|
||
|
{
|
||
|
public:
|
||
|
ObjectRelease() = default;
|
||
|
|
||
|
ObjectRelease( OwnerType owner,
|
||
|
Dispatch const & dispatch VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) VULKAN_HPP_NOEXCEPT
|
||
|
: m_owner( owner )
|
||
|
, m_dispatch( &dispatch )
|
||
|
{}
|
||
|
|
||
|
OwnerType getOwner() const VULKAN_HPP_NOEXCEPT
|
||
|
{
|
||
|
return m_owner;
|
||
|
}
|
||
|
|
||
|
protected:
|
||
|
template <typename T>
|
||
|
void destroy( T t ) VULKAN_HPP_NOEXCEPT
|
||
|
{
|
||
|
VULKAN_HPP_ASSERT( m_owner && m_dispatch );
|
||
|
m_owner.release( t, *m_dispatch );
|
||
|
}
|
||
|
|
||
|
private:
|
||
|
OwnerType m_owner = {};
|
||
|
Dispatch const * m_dispatch = nullptr;
|
||
|
};
|