Provide default arguments in ObjectFree constructor for allocationCallbacks and dispatcher.

This commit is contained in:
asuessenbach
2020-06-18 11:00:22 +02:00
parent 5bee99f228
commit 92bc17981b
3 changed files with 38 additions and 26 deletions

View File

@@ -7305,34 +7305,39 @@ int main( int argc, char ** argv )
template <typename OwnerType, typename Dispatch>
class ObjectFree
{
public:
ObjectFree()
: m_owner()
, m_allocationCallbacks( nullptr )
, m_dispatch( nullptr )
{}
public:
ObjectFree() : m_owner(), m_allocationCallbacks( nullptr ), m_dispatch( nullptr ) {}
ObjectFree( OwnerType owner, Optional<const AllocationCallbacks> allocationCallbacks, Dispatch const &dispatch ) VULKAN_HPP_NOEXCEPT
: m_owner( owner )
, m_allocationCallbacks( allocationCallbacks )
, m_dispatch( &dispatch )
{}
ObjectFree( OwnerType owner,
Optional<const AllocationCallbacks> allocationCallbacks = nullptr,
Dispatch const & dispatch = VULKAN_HPP_DEFAULT_DISPATCHER ) VULKAN_HPP_NOEXCEPT
: m_owner( owner )
, m_allocationCallbacks( allocationCallbacks )
, m_dispatch( &dispatch )
{}
OwnerType getOwner() const VULKAN_HPP_NOEXCEPT { return m_owner; }
Optional<const AllocationCallbacks> getAllocator() const VULKAN_HPP_NOEXCEPT { return m_allocationCallbacks; }
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.free( t, m_allocationCallbacks, *m_dispatch );
}
Optional<const AllocationCallbacks> getAllocator() const VULKAN_HPP_NOEXCEPT
{
return m_allocationCallbacks;
}
private:
OwnerType m_owner;
Optional<const AllocationCallbacks> m_allocationCallbacks;
Dispatch const* m_dispatch;
protected:
template <typename T>
void destroy( T t ) VULKAN_HPP_NOEXCEPT
{
VULKAN_HPP_ASSERT( m_owner && m_dispatch );
m_owner.free( t, m_allocationCallbacks, *m_dispatch );
}
private:
OwnerType m_owner;
Optional<const AllocationCallbacks> m_allocationCallbacks;
Dispatch const * m_dispatch;
};
)";