template class SharedHandleTraits; // Silence the function cast warnings. #if defined( __GNUC__ ) && !defined( __clang__ ) && !defined( __INTEL_COMPILER ) # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wcast-function-type" #endif template class ObjectDestroyShared { public: using DestructorType = typename SharedHandleTraits::DestructorType; template using DestroyFunctionPointerType = typename std::conditional::value, void ( DestructorType::* )( HandleType, const AllocationCallbacks *, const Dispatcher & ) const, void ( HandleType::* )( const AllocationCallbacks *, const Dispatcher & ) const>::type; using SelectorType = typename std::conditional::value, DestructorType, HandleType>::type; template ObjectDestroyShared( Optional allocationCallbacks VULKAN_HPP_DEFAULT_ARGUMENT_NULLPTR_ASSIGNMENT, const Dispatcher & dispatch VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) : m_destroy( reinterpret_cast( static_cast>( &SelectorType::destroy ) ) ) , m_dispatch( &dispatch ) , m_allocationCallbacks( allocationCallbacks ) { } public: template typename std::enable_if::value, void>::type destroy( DestructorType parent, HandleType handle ) const VULKAN_HPP_NOEXCEPT { VULKAN_HPP_ASSERT( m_destroy && m_dispatch ); ( parent.*m_destroy )( handle, m_allocationCallbacks, *m_dispatch ); } template typename std::enable_if::value, void>::type destroy( HandleType handle ) const VULKAN_HPP_NOEXCEPT { VULKAN_HPP_ASSERT( m_destroy && m_dispatch ); ( handle.*m_destroy )( m_allocationCallbacks, *m_dispatch ); } private: DestroyFunctionPointerType m_destroy = nullptr; const DispatchLoaderBase * m_dispatch = nullptr; Optional m_allocationCallbacks = nullptr; }; template class ObjectFreeShared { public: using DestructorType = typename SharedHandleTraits::DestructorType; template using DestroyFunctionPointerType = void ( DestructorType::* )( HandleType, const AllocationCallbacks *, const Dispatcher & ) const; template ObjectFreeShared( Optional allocationCallbacks VULKAN_HPP_DEFAULT_ARGUMENT_NULLPTR_ASSIGNMENT, const Dispatcher & dispatch VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) : m_destroy( reinterpret_cast( static_cast>( &DestructorType::free ) ) ) , m_dispatch( &dispatch ) , m_allocationCallbacks( allocationCallbacks ) { } public: void destroy( DestructorType parent, HandleType handle ) const VULKAN_HPP_NOEXCEPT { VULKAN_HPP_ASSERT( m_destroy && m_dispatch ); ( parent.*m_destroy )( handle, m_allocationCallbacks, *m_dispatch ); } private: DestroyFunctionPointerType m_destroy = nullptr; const DispatchLoaderBase * m_dispatch = nullptr; Optional m_allocationCallbacks = nullptr; }; template class ObjectReleaseShared { public: using DestructorType = typename SharedHandleTraits::DestructorType; template using DestroyFunctionPointerType = void ( DestructorType::* )( HandleType, const Dispatcher & ) const; template ObjectReleaseShared( const Dispatcher & dispatch VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) : m_destroy( reinterpret_cast( static_cast>( &DestructorType::release ) ) ) , m_dispatch( &dispatch ) { } public: void destroy( DestructorType parent, HandleType handle ) const VULKAN_HPP_NOEXCEPT { VULKAN_HPP_ASSERT( m_destroy && m_dispatch ); ( parent.*m_destroy )( handle, *m_dispatch ); } private: DestroyFunctionPointerType m_destroy = nullptr; const DispatchLoaderBase * m_dispatch = nullptr; }; template class PoolFreeShared { public: using DestructorType = typename SharedHandleTraits::DestructorType; template using ReturnType = decltype( std::declval().free( PoolType(), 0u, nullptr, Dispatcher() ) ); template using DestroyFunctionPointerType = ReturnType ( DestructorType::* )( PoolType, uint32_t, const HandleType *, const Dispatcher & ) const; PoolFreeShared() = default; template PoolFreeShared( SharedHandle pool, const Dispatcher & dispatch VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) : m_destroy( reinterpret_cast( static_cast>( &DestructorType::free ) ) ) , m_dispatch( &dispatch ) , m_pool( std::move( pool ) ) { } public: void destroy( DestructorType parent, HandleType handle ) const VULKAN_HPP_NOEXCEPT { VULKAN_HPP_ASSERT( m_destroy && m_dispatch ); ( parent.*m_destroy )( m_pool.get(), 1u, &handle, *m_dispatch ); } private: DestroyFunctionPointerType m_destroy = nullptr; const DispatchLoaderBase * m_dispatch = nullptr; SharedHandle m_pool{}; }; #if defined( __GNUC__ ) && !defined( __clang__ ) && !defined( __INTEL_COMPILER ) # pragma GCC diagnostic pop #endif