Introduce constructors of ArrayProxy and ArrayProxyNoTemporaries from std::span (C++20)
This commit is contained in:
@@ -39,7 +39,6 @@
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
#if 17 <= VULKAN_HPP_CPP_VERSION
|
||||
# include <string_view>
|
||||
#endif
|
||||
@@ -111,6 +110,11 @@ extern "C" __declspec( dllimport ) FARPROC __stdcall GetProcAddress( HINSTANCE h
|
||||
# include <compare>
|
||||
#endif
|
||||
|
||||
#if ( 201803 <= __cpp_lib_span )
|
||||
# define VULKAN_HPP_SUPPORT_SPAN
|
||||
# include <span>
|
||||
#endif
|
||||
|
||||
static_assert( VK_HEADER_VERSION == 187, "Wrong VK_HEADER_VERSION!" );
|
||||
|
||||
// 32-bit vulkan is not typesafe for handles, so don't allow copy constructors on this platform by default.
|
||||
@@ -352,6 +356,36 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
, m_ptr( data.data() )
|
||||
{}
|
||||
|
||||
# if defined( VULKAN_HPP_SUPPORT_SPAN )
|
||||
template <size_t N = std::dynamic_extent>
|
||||
ArrayProxy( std::span<T, N> const & data ) VULKAN_HPP_NOEXCEPT
|
||||
: m_count( static_cast<uint32_t>( data.size() ) )
|
||||
, m_ptr( data.data() )
|
||||
{}
|
||||
|
||||
template <size_t N = std::dynamic_extent,
|
||||
typename B = T,
|
||||
typename std::enable_if<std::is_const<B>::value, int>::type = 0>
|
||||
ArrayProxy( std::span<typename std::remove_const<T>::type, N> const & data ) VULKAN_HPP_NOEXCEPT
|
||||
: m_count( static_cast<uint32_t>( data.size() ) )
|
||||
, m_ptr( data.data() )
|
||||
{}
|
||||
|
||||
template <size_t N = std::dynamic_extent>
|
||||
ArrayProxy( std::span<T, N> & data ) VULKAN_HPP_NOEXCEPT
|
||||
: m_count( static_cast<uint32_t>( data.size() ) )
|
||||
, m_ptr( data.data() )
|
||||
{}
|
||||
|
||||
template <size_t N = std::dynamic_extent,
|
||||
typename B = T,
|
||||
typename std::enable_if<std::is_const<B>::value, int>::type = 0>
|
||||
ArrayProxy( std::span<typename std::remove_const<T>::type, N> & data ) VULKAN_HPP_NOEXCEPT
|
||||
: m_count( static_cast<uint32_t>( data.size() ) )
|
||||
, m_ptr( data.data() )
|
||||
{}
|
||||
# endif
|
||||
|
||||
const T * begin() const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return m_ptr;
|
||||
@@ -549,6 +583,36 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
typename std::enable_if<std::is_const<B>::value, int>::type = 0>
|
||||
ArrayProxyNoTemporaries( std::vector<typename std::remove_const<T>::type, Allocator> && data ) = delete;
|
||||
|
||||
# if defined( VULKAN_HPP_SUPPORT_SPAN )
|
||||
template <size_t N = std::dynamic_extent>
|
||||
ArrayProxyNoTemporaries( std::span<T, N> const & data ) VULKAN_HPP_NOEXCEPT
|
||||
: m_count( static_cast<uint32_t>( data.size() ) )
|
||||
, m_ptr( data.data() )
|
||||
{}
|
||||
|
||||
template <size_t N = std::dynamic_extent,
|
||||
typename B = T,
|
||||
typename std::enable_if<std::is_const<B>::value, int>::type = 0>
|
||||
ArrayProxyNoTemporaries( std::span<typename std::remove_const<T>::type, N> const & data ) VULKAN_HPP_NOEXCEPT
|
||||
: m_count( static_cast<uint32_t>( data.size() ) )
|
||||
, m_ptr( data.data() )
|
||||
{}
|
||||
|
||||
template <size_t N = std::dynamic_extent>
|
||||
ArrayProxyNoTemporaries( std::span<T, N> & data ) VULKAN_HPP_NOEXCEPT
|
||||
: m_count( static_cast<uint32_t>( data.size() ) )
|
||||
, m_ptr( data.data() )
|
||||
{}
|
||||
|
||||
template <size_t N = std::dynamic_extent,
|
||||
typename B = T,
|
||||
typename std::enable_if<std::is_const<B>::value, int>::type = 0>
|
||||
ArrayProxyNoTemporaries( std::span<typename std::remove_const<T>::type, N> & data ) VULKAN_HPP_NOEXCEPT
|
||||
: m_count( static_cast<uint32_t>( data.size() ) )
|
||||
, m_ptr( data.data() )
|
||||
{}
|
||||
# endif
|
||||
|
||||
const T * begin() const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return m_ptr;
|
||||
|
||||
Reference in New Issue
Block a user