Refactor top-level function to generate vulkan.hpp
This commit is contained in:
33
snippets/Optional.hpp
Normal file
33
snippets/Optional.hpp
Normal file
@@ -0,0 +1,33 @@
|
||||
template <typename RefType>
|
||||
class Optional
|
||||
{
|
||||
public:
|
||||
Optional( RefType & reference ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
m_ptr = &reference;
|
||||
}
|
||||
Optional( RefType * ptr ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
m_ptr = ptr;
|
||||
}
|
||||
Optional( std::nullptr_t ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
m_ptr = nullptr;
|
||||
}
|
||||
|
||||
operator RefType *() const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return m_ptr;
|
||||
}
|
||||
RefType const * operator->() const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return m_ptr;
|
||||
}
|
||||
explicit operator bool() const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return !!m_ptr;
|
||||
}
|
||||
|
||||
private:
|
||||
RefType * m_ptr;
|
||||
};
|
||||
Reference in New Issue
Block a user