Merge pull request #1288 from phantom10111/array-proxy-with-raw-arrays

Add ArrayProxy constructors with support for raw array with size
This commit is contained in:
Andreas Süßenbach
2022-04-19 17:38:31 +02:00
committed by GitHub
5 changed files with 226 additions and 66 deletions

View File

@@ -283,6 +283,20 @@ namespace VULKAN_HPP_NAMESPACE
{
}
template <std::size_t C>
ArrayProxy( T ( &ptr )[C] ) VULKAN_HPP_NOEXCEPT
: m_count( C )
, m_ptr( ptr )
{
}
template <std::size_t C, typename B = T, typename std::enable_if<std::is_const<B>::value, int>::type = 0>
ArrayProxy( typename std::remove_const<T>::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 <std::size_t C>
ArrayProxyNoTemporaries( T ( &ptr )[C] ) VULKAN_HPP_NOEXCEPT
: m_count( C )
, m_ptr( ptr )
{
}
template <std::size_t C>
ArrayProxyNoTemporaries( T( &&ptr )[C] ) = delete;
template <std::size_t C, typename B = T, typename std::enable_if<std::is_const<B>::value, int>::type = 0>
ArrayProxyNoTemporaries( typename std::remove_const<T>::type ( &ptr )[C] ) VULKAN_HPP_NOEXCEPT
: m_count( C )
, m_ptr( ptr )
{
}
template <std::size_t C, typename B = T, typename std::enable_if<std::is_const<B>::value, int>::type = 0>
ArrayProxyNoTemporaries( typename std::remove_const<T>::type( &&ptr )[C] ) = delete;
ArrayProxyNoTemporaries( std::initializer_list<T> const & list ) VULKAN_HPP_NOEXCEPT
: m_count( static_cast<uint32_t>( list.size() ) )
, m_ptr( list.begin() )