From f15f2f382b6ac41376ad13162b134b0d23025d8f Mon Sep 17 00:00:00 2001 From: asuessenbach Date: Tue, 5 May 2020 11:34:02 +0200 Subject: [PATCH] Reintroduce ArrayProxy constructors with std::array and std::vector --- VulkanHppGenerator.cpp | 52 +++++++++++++++++++++++++++++++++------ vulkan/vulkan.hpp | 56 ++++++++++++++++++++++++++++++++++++------ 2 files changed, 92 insertions(+), 16 deletions(-) diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index a312b2d..22079e9 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -6772,16 +6772,52 @@ int main( int argc, char ** argv ) , m_ptr(list.begin()) {} - template - ArrayProxy(Container const& container) VULKAN_HPP_NOEXCEPT - : m_count(static_cast(container.size())) - , m_ptr(container.data()) + template + ArrayProxy(std::array const & data) VULKAN_HPP_NOEXCEPT + : m_count(N) + , m_ptr(data.data()) {} - template - ArrayProxy(Container & container) VULKAN_HPP_NOEXCEPT - : m_count(static_cast(container.size())) - , m_ptr(container.data()) + template ::value, int>::type = 0> + ArrayProxy(std::array::type, N> const & data) VULKAN_HPP_NOEXCEPT + : m_count(N) + , m_ptr(data.data()) + {} + + template + ArrayProxy(std::array & data) VULKAN_HPP_NOEXCEPT + : m_count(N) + , m_ptr(data.data()) + {} + + template ::value, int>::type = 0> + ArrayProxy(std::array::type, N> & data) VULKAN_HPP_NOEXCEPT + : m_count(N) + , m_ptr(data.data()) + {} + + template ::type>> + ArrayProxy(std::vector const & data) VULKAN_HPP_NOEXCEPT + : m_count(static_cast(data.size())) + , m_ptr(data.data()) + {} + + template ::type>, typename B = T, typename std::enable_if::value, int>::type = 0> + ArrayProxy(std::vector::type, Allocator> const& data) VULKAN_HPP_NOEXCEPT + : m_count(static_cast(data.size())) + , m_ptr(data.data()) + {} + + template ::type>> + ArrayProxy(std::vector & data) VULKAN_HPP_NOEXCEPT + : m_count(static_cast(data.size())) + , m_ptr(data.data()) + {} + + template ::type>, typename B = T, typename std::enable_if::value, int>::type = 0> + ArrayProxy(std::vector::type, Allocator> & data) VULKAN_HPP_NOEXCEPT + : m_count(static_cast(data.size())) + , m_ptr(data.data()) {} const T * begin() const VULKAN_HPP_NOEXCEPT diff --git a/vulkan/vulkan.hpp b/vulkan/vulkan.hpp index 27b3326..17ac8c9 100644 --- a/vulkan/vulkan.hpp +++ b/vulkan/vulkan.hpp @@ -246,16 +246,56 @@ namespace VULKAN_HPP_NAMESPACE , m_ptr( list.begin() ) {} - template - ArrayProxy( Container const & container ) VULKAN_HPP_NOEXCEPT - : m_count( static_cast( container.size() ) ) - , m_ptr( container.data() ) + template + ArrayProxy( std::array const & data ) VULKAN_HPP_NOEXCEPT + : m_count( N ) + , m_ptr( data.data() ) {} - template - ArrayProxy( Container & container ) VULKAN_HPP_NOEXCEPT - : m_count( static_cast( container.size() ) ) - , m_ptr( container.data() ) + template ::value, int>::type = 0> + ArrayProxy( std::array::type, N> const & data ) VULKAN_HPP_NOEXCEPT + : m_count( N ) + , m_ptr( data.data() ) + {} + + template + ArrayProxy( std::array & data ) VULKAN_HPP_NOEXCEPT + : m_count( N ) + , m_ptr( data.data() ) + {} + + template ::value, int>::type = 0> + ArrayProxy( std::array::type, N> & data ) VULKAN_HPP_NOEXCEPT + : m_count( N ) + , m_ptr( data.data() ) + {} + + template ::type>> + ArrayProxy( std::vector const & data ) VULKAN_HPP_NOEXCEPT + : m_count( static_cast( data.size() ) ) + , m_ptr( data.data() ) + {} + + template ::type>, + typename B = T, + typename std::enable_if::value, int>::type = 0> + ArrayProxy( std::vector::type, Allocator> const & data ) VULKAN_HPP_NOEXCEPT + : m_count( static_cast( data.size() ) ) + , m_ptr( data.data() ) + {} + + template ::type>> + ArrayProxy( std::vector & data ) VULKAN_HPP_NOEXCEPT + : m_count( static_cast( data.size() ) ) + , m_ptr( data.data() ) + {} + + template ::type>, + typename B = T, + typename std::enable_if::value, int>::type = 0> + ArrayProxy( std::vector::type, Allocator> & data ) VULKAN_HPP_NOEXCEPT + : m_count( static_cast( data.size() ) ) + , m_ptr( data.data() ) {} const T * begin() const VULKAN_HPP_NOEXCEPT