Add UniqueHandle non-const accessors, ensure all by reference. (#123)

* Add UniqueHandle non-const accessors, ensure all by reference.

- Add `Type * operator->()`
- Fix `Type get() const` to `const Type & get() const`
- Add `Type & get()`

* Add support for structure pointer chains was missing some generator code.

* Update vulkan.hpp with changes.
This commit is contained in:
Samuel Williams 2017-09-15 01:22:47 +12:00 committed by Markus Tavenrath
parent bca6564dac
commit daae0b6194
2 changed files with 36 additions and 6 deletions

View File

@ -381,8 +381,8 @@ const std::string structureChainHeader = R"(
StructureChain& operator=(StructureChain const &rhs) StructureChain& operator=(StructureChain const &rhs)
{ {
linkAndCopy(rhs); linkAndCopy<StructureElements...>(rhs);
return this; return *this;
} }
template<typename ClassType> ClassType& get() { return static_cast<ClassType&>(*this);} template<typename ClassType> ClassType& get() { return static_cast<ClassType&>(*this);}
@ -608,12 +608,27 @@ const std::string uniqueHandleHeader = R"(
return &m_value; return &m_value;
} }
Type * operator->()
{
return &m_value;
}
Type const& operator*() const Type const& operator*() const
{ {
return m_value; return m_value;
} }
Type get() const Type & operator*()
{
return m_value;
}
const Type & get() const
{
return m_value;
}
Type & get()
{ {
return m_value; return m_value;
} }

View File

@ -362,12 +362,27 @@ namespace vk
return &m_value; return &m_value;
} }
Type * operator->()
{
return &m_value;
}
Type const& operator*() const Type const& operator*() const
{ {
return m_value; return m_value;
} }
Type get() const Type & operator*()
{
return m_value;
}
const Type & get() const
{
return m_value;
}
Type & get()
{ {
return m_value; return m_value;
} }