enum class SwapchainOwns { no, yes, }; struct ImageHeader : SharedHeader, typename SharedHandleTraits::deleter> { ImageHeader( SharedHandle> parent, typename SharedHandleTraits::deleter deleter = typename SharedHandleTraits::deleter(), SwapchainOwns swapchainOwned = SwapchainOwns::no ) VULKAN_HPP_NOEXCEPT : SharedHeader, typename SharedHandleTraits::deleter>( std::move( parent ), std::move( deleter ) ) , swapchainOwned( swapchainOwned ) { } SwapchainOwns swapchainOwned = SwapchainOwns::no; }; template <> class SharedHandle : public SharedHandleBase { using BaseType = SharedHandleBase; using DeleterType = typename SharedHandleTraits::deleter; friend BaseType; public: SharedHandle() = default; explicit SharedHandle( VULKAN_HPP_NAMESPACE::Image handle, SharedHandle> parent, SwapchainOwns swapchain_owned = SwapchainOwns::no, DeleterType deleter = DeleterType() ) VULKAN_HPP_NOEXCEPT : BaseType( handle, std::move( parent ), std::move( deleter ), swapchain_owned ) { } protected: static void internalDestroy( const ImageHeader & control, VULKAN_HPP_NAMESPACE::Image handle ) VULKAN_HPP_NOEXCEPT { if ( control.swapchainOwned == SwapchainOwns::no ) { control.deleter.destroy( control.parent.get(), handle ); } } }; struct SwapchainHeader { SwapchainHeader( SharedHandle surface, SharedHandle> parent, typename SharedHandleTraits::deleter deleter = typename SharedHandleTraits::deleter() ) VULKAN_HPP_NOEXCEPT : surface( std::move( surface ) ) , parent( std::move( parent ) ) , deleter( std::move( deleter ) ) { } SharedHandle surface{}; SharedHandle> parent{}; typename SharedHandleTraits::deleter deleter{}; }; template <> class SharedHandle : public SharedHandleBase { using BaseType = SharedHandleBase; using DeleterType = typename SharedHandleTraits::deleter; friend BaseType; public: SharedHandle() = default; explicit SharedHandle( VULKAN_HPP_NAMESPACE::SwapchainKHR handle, SharedHandle> parent, SharedHandle surface, DeleterType deleter = DeleterType() ) VULKAN_HPP_NOEXCEPT : BaseType( handle, std::move( surface ), std::move( parent ), std::move( deleter ) ) { } public: const SharedHandle & getSurface() const VULKAN_HPP_NOEXCEPT { return getHeader().surface; } protected: using BaseType::internalDestroy; }; template class SharedHandleBaseNoDestroy : public SharedHandleBase { public: using SharedHandleBase::SharedHandleBase; const DestructorType & getDestructorType() const VULKAN_HPP_NOEXCEPT { return SharedHandleBase::getHeader(); } protected: static void internalDestroy( const DestructorType &, HandleType ) VULKAN_HPP_NOEXCEPT {} };