Introduce default constructors for UniqueHandle, ObjectDestroy, and ObjectFree (#446)

This commit is contained in:
Andreas Süßenbach 2019-11-28 16:01:22 +01:00 committed by Markus Tavenrath
parent f2058303cb
commit 07edfc45d6
2 changed files with 56 additions and 6 deletions

View File

@ -4589,7 +4589,13 @@ int main( int argc, char **argv )
class ObjectDestroy class ObjectDestroy
{ {
public: public:
ObjectDestroy( OwnerType owner = OwnerType(), Optional<const AllocationCallbacks> allocationCallbacks = nullptr, Dispatch const &dispatch = VULKAN_HPP_DEFAULT_DISPATCHER ) VULKAN_HPP_NOEXCEPT ObjectDestroy()
: m_owner()
, m_allocationCallbacks( nullptr )
, m_dispatch( nullptr )
{}
ObjectDestroy( OwnerType owner, Optional<const AllocationCallbacks> allocationCallbacks, Dispatch const &dispatch ) VULKAN_HPP_NOEXCEPT
: m_owner( owner ) : m_owner( owner )
, m_allocationCallbacks( allocationCallbacks ) , m_allocationCallbacks( allocationCallbacks )
, m_dispatch( &dispatch ) , m_dispatch( &dispatch )
@ -4602,6 +4608,7 @@ int main( int argc, char **argv )
template <typename T> template <typename T>
void destroy(T t) VULKAN_HPP_NOEXCEPT void destroy(T t) VULKAN_HPP_NOEXCEPT
{ {
assert( m_owner && m_dispatch );
m_owner.destroy( t, m_allocationCallbacks, *m_dispatch ); m_owner.destroy( t, m_allocationCallbacks, *m_dispatch );
} }
@ -4617,6 +4624,11 @@ int main( int argc, char **argv )
class ObjectDestroy<NoParent,Dispatch> class ObjectDestroy<NoParent,Dispatch>
{ {
public: public:
ObjectDestroy()
: m_allocationCallbacks( nullptr )
, m_dispatch( nullptr )
{}
ObjectDestroy( Optional<const AllocationCallbacks> allocationCallbacks = nullptr, Dispatch const &dispatch = VULKAN_HPP_DEFAULT_DISPATCHER ) VULKAN_HPP_NOEXCEPT ObjectDestroy( Optional<const AllocationCallbacks> allocationCallbacks = nullptr, Dispatch const &dispatch = VULKAN_HPP_DEFAULT_DISPATCHER ) VULKAN_HPP_NOEXCEPT
: m_allocationCallbacks( allocationCallbacks ) : m_allocationCallbacks( allocationCallbacks )
, m_dispatch( &dispatch ) , m_dispatch( &dispatch )
@ -4628,6 +4640,7 @@ int main( int argc, char **argv )
template <typename T> template <typename T>
void destroy(T t) VULKAN_HPP_NOEXCEPT void destroy(T t) VULKAN_HPP_NOEXCEPT
{ {
assert( m_dispatch );
t.destroy( m_allocationCallbacks, *m_dispatch ); t.destroy( m_allocationCallbacks, *m_dispatch );
} }
@ -4642,7 +4655,13 @@ int main( int argc, char **argv )
class ObjectFree class ObjectFree
{ {
public: public:
ObjectFree( OwnerType owner = OwnerType(), Optional<const AllocationCallbacks> allocationCallbacks = nullptr, Dispatch const &dispatch = VULKAN_HPP_DEFAULT_DISPATCHER ) VULKAN_HPP_NOEXCEPT 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_owner( owner )
, m_allocationCallbacks( allocationCallbacks ) , m_allocationCallbacks( allocationCallbacks )
, m_dispatch( &dispatch ) , m_dispatch( &dispatch )
@ -4655,6 +4674,7 @@ int main( int argc, char **argv )
template <typename T> template <typename T>
void destroy(T t) VULKAN_HPP_NOEXCEPT void destroy(T t) VULKAN_HPP_NOEXCEPT
{ {
assert( m_owner && m_dispatch );
m_owner.free( t, m_allocationCallbacks, *m_dispatch ); m_owner.free( t, m_allocationCallbacks, *m_dispatch );
} }
@ -4904,7 +4924,12 @@ int main( int argc, char **argv )
public: public:
using element_type = Type; using element_type = Type;
explicit UniqueHandle( Type const& value = Type(), Deleter const& deleter = Deleter() ) VULKAN_HPP_NOEXCEPT UniqueHandle()
: Deleter()
, m_value()
{}
explicit UniqueHandle( Type const& value, Deleter const& deleter = Deleter() ) VULKAN_HPP_NOEXCEPT
: Deleter( deleter) : Deleter( deleter)
, m_value( value ) , m_value( value )
{} {}

View File

@ -594,7 +594,12 @@ namespace VULKAN_HPP_NAMESPACE
public: public:
using element_type = Type; using element_type = Type;
explicit UniqueHandle( Type const& value = Type(), Deleter const& deleter = Deleter() ) VULKAN_HPP_NOEXCEPT UniqueHandle()
: Deleter()
, m_value()
{}
explicit UniqueHandle( Type const& value, Deleter const& deleter = Deleter() ) VULKAN_HPP_NOEXCEPT
: Deleter( deleter) : Deleter( deleter)
, m_value( value ) , m_value( value )
{} {}
@ -2646,7 +2651,13 @@ namespace VULKAN_HPP_NAMESPACE
class ObjectDestroy class ObjectDestroy
{ {
public: public:
ObjectDestroy( OwnerType owner = OwnerType(), Optional<const AllocationCallbacks> allocationCallbacks = nullptr, Dispatch const &dispatch = VULKAN_HPP_DEFAULT_DISPATCHER ) VULKAN_HPP_NOEXCEPT ObjectDestroy()
: m_owner()
, m_allocationCallbacks( nullptr )
, m_dispatch( nullptr )
{}
ObjectDestroy( OwnerType owner, Optional<const AllocationCallbacks> allocationCallbacks, Dispatch const &dispatch ) VULKAN_HPP_NOEXCEPT
: m_owner( owner ) : m_owner( owner )
, m_allocationCallbacks( allocationCallbacks ) , m_allocationCallbacks( allocationCallbacks )
, m_dispatch( &dispatch ) , m_dispatch( &dispatch )
@ -2659,6 +2670,7 @@ namespace VULKAN_HPP_NAMESPACE
template <typename T> template <typename T>
void destroy(T t) VULKAN_HPP_NOEXCEPT void destroy(T t) VULKAN_HPP_NOEXCEPT
{ {
assert( m_owner && m_dispatch );
m_owner.destroy( t, m_allocationCallbacks, *m_dispatch ); m_owner.destroy( t, m_allocationCallbacks, *m_dispatch );
} }
@ -2674,6 +2686,11 @@ namespace VULKAN_HPP_NAMESPACE
class ObjectDestroy<NoParent,Dispatch> class ObjectDestroy<NoParent,Dispatch>
{ {
public: public:
ObjectDestroy()
: m_allocationCallbacks( nullptr )
, m_dispatch( nullptr )
{}
ObjectDestroy( Optional<const AllocationCallbacks> allocationCallbacks = nullptr, Dispatch const &dispatch = VULKAN_HPP_DEFAULT_DISPATCHER ) VULKAN_HPP_NOEXCEPT ObjectDestroy( Optional<const AllocationCallbacks> allocationCallbacks = nullptr, Dispatch const &dispatch = VULKAN_HPP_DEFAULT_DISPATCHER ) VULKAN_HPP_NOEXCEPT
: m_allocationCallbacks( allocationCallbacks ) : m_allocationCallbacks( allocationCallbacks )
, m_dispatch( &dispatch ) , m_dispatch( &dispatch )
@ -2685,6 +2702,7 @@ namespace VULKAN_HPP_NAMESPACE
template <typename T> template <typename T>
void destroy(T t) VULKAN_HPP_NOEXCEPT void destroy(T t) VULKAN_HPP_NOEXCEPT
{ {
assert( m_dispatch );
t.destroy( m_allocationCallbacks, *m_dispatch ); t.destroy( m_allocationCallbacks, *m_dispatch );
} }
@ -2697,7 +2715,13 @@ namespace VULKAN_HPP_NAMESPACE
class ObjectFree class ObjectFree
{ {
public: public:
ObjectFree( OwnerType owner = OwnerType(), Optional<const AllocationCallbacks> allocationCallbacks = nullptr, Dispatch const &dispatch = VULKAN_HPP_DEFAULT_DISPATCHER ) VULKAN_HPP_NOEXCEPT 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_owner( owner )
, m_allocationCallbacks( allocationCallbacks ) , m_allocationCallbacks( allocationCallbacks )
, m_dispatch( &dispatch ) , m_dispatch( &dispatch )
@ -2710,6 +2734,7 @@ namespace VULKAN_HPP_NAMESPACE
template <typename T> template <typename T>
void destroy(T t) VULKAN_HPP_NOEXCEPT void destroy(T t) VULKAN_HPP_NOEXCEPT
{ {
assert( m_owner && m_dispatch );
m_owner.free( t, m_allocationCallbacks, *m_dispatch ); m_owner.free( t, m_allocationCallbacks, *m_dispatch );
} }