mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
extra constructor for uniquehandles that take the owner variable directly
This commit is contained in:
parent
a9b5b68572
commit
295ab10a6d
@ -634,6 +634,7 @@ const std::string uniqueHandleHeader = R"(
|
|||||||
class UniqueHandle : public UniqueHandleTraits<Type,Dispatch>::deleter
|
class UniqueHandle : public UniqueHandleTraits<Type,Dispatch>::deleter
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
using Owner = typename UniqueHandleTraits<Type,Dispatch>::owner;
|
||||||
using Deleter = typename UniqueHandleTraits<Type,Dispatch>::deleter;
|
using Deleter = typename UniqueHandleTraits<Type,Dispatch>::deleter;
|
||||||
public:
|
public:
|
||||||
explicit UniqueHandle( Type const& value = Type(), Deleter const& deleter = Deleter() )
|
explicit UniqueHandle( Type const& value = Type(), Deleter const& deleter = Deleter() )
|
||||||
@ -641,6 +642,11 @@ const std::string uniqueHandleHeader = R"(
|
|||||||
, m_value( value )
|
, m_value( value )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
explicit UniqueHandle( Type const& value = Type(), Owner const& owner = Owner() )
|
||||||
|
: Deleter( owner)
|
||||||
|
, m_value( value )
|
||||||
|
{}
|
||||||
|
|
||||||
UniqueHandle( UniqueHandle const& ) = delete;
|
UniqueHandle( UniqueHandle const& ) = delete;
|
||||||
|
|
||||||
UniqueHandle( UniqueHandle && other )
|
UniqueHandle( UniqueHandle && other )
|
||||||
@ -4787,7 +4793,9 @@ void VulkanHppGenerator::writeUniqueTypes(std::ostream &os, std::pair<std::strin
|
|||||||
auto ddit = m_deleters.find(dt);
|
auto ddit = m_deleters.find(dt);
|
||||||
assert(ddit != m_deleters.end());
|
assert(ddit != m_deleters.end());
|
||||||
|
|
||||||
os << " template <typename Dispatch> class UniqueHandleTraits<" << dt << ",Dispatch> {public: using deleter = " << (ddit->second.pool.empty() ? "Object" : "Pool") << ((ddit->second.call.substr(0, 4) == "free") ? "Free<" : "Destroy<") << (deleterTypes.first.empty() ? "NoParent" : deleterTypes.first) << (ddit->second.pool.empty() ? "" : ", " + ddit->second.pool) << ",Dispatch>; };\n";
|
std::string deleterType = (deleterTypes.first.empty() ? "NoParent" : deleterTypes.first);
|
||||||
|
|
||||||
|
os << " template <typename Dispatch> class UniqueHandleTraits<" << dt << ",Dispatch> {public: " << "using owner = " << deleterType << "; " << "using deleter = " << (ddit->second.pool.empty() ? "Object" : "Pool") << ((ddit->second.call.substr(0, 4) == "free") ? "Free<" : "Destroy<") << "owner" << (ddit->second.pool.empty() ? "" : ", " + ddit->second.pool) << ",Dispatch>;};\n";
|
||||||
os << " using Unique" << dt << " = UniqueHandle<" << dt << ",DispatchLoaderStatic>;" << std::endl;
|
os << " using Unique" << dt << " = UniqueHandle<" << dt << ",DispatchLoaderStatic>;" << std::endl;
|
||||||
}
|
}
|
||||||
os << "#endif /*VULKAN_HPP_NO_SMART_HANDLE*/" << std::endl
|
os << "#endif /*VULKAN_HPP_NO_SMART_HANDLE*/" << std::endl
|
||||||
|
90368
vulkan/vulkan.hpp
90368
vulkan/vulkan.hpp
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user