diff --git a/README.md b/README.md index ac81501..a23c802 100644 --- a/README.md +++ b/README.md @@ -185,6 +185,10 @@ c.setScissor(0, scissorRect); // pass a temporary value. c.setScissor(0, { { 0, 0 },{ 640, 480 } }); +// pass a fixed size array +vk::Rect2D scissorRects[2] = { { { 0, 0 }, { 320, 240 } }, { { 320, 240 }, { 320, 240 } } }; +c.setScissor(0, scissorRects); + // generate a std::initializer_list using two rectangles from the stack. This might generate a copy of the rectangles. vk::Rect2D scissorRect1 = { { 0, 0 },{ 320, 240 } }; vk::Rect2D scissorRect2 = { { 320, 240 },{ 320, 240 } }; diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index 8d756b6..1a8bb35 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -14851,6 +14851,18 @@ int main( int argc, char ** argv ) , m_ptr( ptr ) {} + template + ArrayProxy( T (& ptr)[C] ) VULKAN_HPP_NOEXCEPT + : m_count( C ) + , m_ptr( ptr ) + {} + + template ::value, int>::type = 0> + ArrayProxy( typename std::remove_const::type (& ptr)[C] ) VULKAN_HPP_NOEXCEPT + : m_count( C ) + , m_ptr( ptr ) + {} + # if __GNUC__ >= 9 # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Winit-list-lifetime" @@ -14986,6 +14998,24 @@ int main( int argc, char ** argv ) , m_ptr( ptr ) {} + template + ArrayProxyNoTemporaries( T (& ptr)[C] ) VULKAN_HPP_NOEXCEPT + : m_count( C ) + , m_ptr( ptr ) + {} + + template + ArrayProxyNoTemporaries( T (&& ptr)[C] ) = delete; + + template ::value, int>::type = 0> + ArrayProxyNoTemporaries( typename std::remove_const::type (& ptr)[C] ) VULKAN_HPP_NOEXCEPT + : m_count( C ) + , m_ptr( ptr ) + {} + + template ::value, int>::type = 0> + ArrayProxyNoTemporaries( typename std::remove_const::type (&& ptr)[C] ) = delete; + ArrayProxyNoTemporaries( std::initializer_list const & list ) VULKAN_HPP_NOEXCEPT : m_count( static_cast( list.size() ) ) , m_ptr( list.begin() ) diff --git a/vulkan/vulkan.hpp b/vulkan/vulkan.hpp index c10a4f8..3de26fc 100644 --- a/vulkan/vulkan.hpp +++ b/vulkan/vulkan.hpp @@ -283,6 +283,20 @@ namespace VULKAN_HPP_NAMESPACE { } + template + ArrayProxy( T ( &ptr )[C] ) VULKAN_HPP_NOEXCEPT + : m_count( C ) + , m_ptr( ptr ) + { + } + + template ::value, int>::type = 0> + ArrayProxy( typename std::remove_const::type ( &ptr )[C] ) VULKAN_HPP_NOEXCEPT + : m_count( C ) + , m_ptr( ptr ) + { + } + # if __GNUC__ >= 9 # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Winit-list-lifetime" @@ -428,6 +442,26 @@ namespace VULKAN_HPP_NAMESPACE { } + template + ArrayProxyNoTemporaries( T ( &ptr )[C] ) VULKAN_HPP_NOEXCEPT + : m_count( C ) + , m_ptr( ptr ) + { + } + + template + ArrayProxyNoTemporaries( T( &&ptr )[C] ) = delete; + + template ::value, int>::type = 0> + ArrayProxyNoTemporaries( typename std::remove_const::type ( &ptr )[C] ) VULKAN_HPP_NOEXCEPT + : m_count( C ) + , m_ptr( ptr ) + { + } + + template ::value, int>::type = 0> + ArrayProxyNoTemporaries( typename std::remove_const::type( &&ptr )[C] ) = delete; + ArrayProxyNoTemporaries( std::initializer_list const & list ) VULKAN_HPP_NOEXCEPT : m_count( static_cast( list.size() ) ) , m_ptr( list.begin() )