Introduce cast-operator to std::string and std::string_view on ArrayWrapper1D<char,N>

-> needed to add all the relational operators on <char,N> as well to keep the compiler happy!
This commit is contained in:
asuessenbach 2020-06-17 16:20:23 +02:00
parent 8c2d6d7d05
commit 1075096d8c
2 changed files with 146 additions and 2 deletions

View File

@ -6940,6 +6940,56 @@ int main( int argc, char ** argv )
{
return this->data();
}
template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>
operator std::string const () const VULKAN_HPP_NOEXCEPT
{
return std::string( this->data() );
}
#if 17 <= VULKAN_HPP_CPP_VERSION
template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>
operator std::string_view const () const VULKAN_HPP_NOEXCEPT
{
return std::string_view( this->data() );
}
#endif
template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>
bool operator<( ArrayWrapper1D<char, N> const & rhs ) const VULKAN_HPP_NOEXCEPT
{
return *static_cast<std::array<char, N> const *>( this ) < *static_cast<std::array<char, N> const *>( &rhs );
}
template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>
bool operator<=( ArrayWrapper1D<char, N> const & rhs ) const VULKAN_HPP_NOEXCEPT
{
return *static_cast<std::array<char, N> const *>( this ) <= *static_cast<std::array<char, N> const *>( &rhs );
}
template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>
bool operator>( ArrayWrapper1D<char, N> const & rhs ) const VULKAN_HPP_NOEXCEPT
{
return *static_cast<std::array<char, N> const *>( this ) > *static_cast<std::array<char, N> const *>( &rhs );
}
template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>
bool operator>=( ArrayWrapper1D<char, N> const & rhs ) const VULKAN_HPP_NOEXCEPT
{
return *static_cast<std::array<char, N> const *>( this ) >= *static_cast<std::array<char, N> const *>( &rhs );
}
template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>
bool operator==( ArrayWrapper1D<char, N> const & rhs ) const VULKAN_HPP_NOEXCEPT
{
return *static_cast<std::array<char, N> const *>( this ) == *static_cast<std::array<char, N> const *>( &rhs );
}
template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>
bool operator!=( ArrayWrapper1D<char, N> const & rhs ) const VULKAN_HPP_NOEXCEPT
{
return *static_cast<std::array<char, N> const *>( this ) != *static_cast<std::array<char, N> const *>( &rhs );
}
};
// specialization of relational operators between std::string and arrays of chars
@ -7758,7 +7808,7 @@ int main( int argc, char ** argv )
# endif
#endif
#if __cplusplus >= 201402L
#if 14 <= VULKAN_HPP_CPP_VERSION
# define VULKAN_HPP_DEPRECATED( msg ) [[deprecated( msg )]]
#else
# define VULKAN_HPP_DEPRECATED( msg )
@ -7842,6 +7892,24 @@ int main( int argc, char ** argv )
#ifndef VULKAN_HPP
#define VULKAN_HPP
#if defined( _MSVC_LANG )
# define VULKAN_HPP_CPLUSPLUS _MSVC_LANG
#else
# define VULKAN_HPP_CPLUSPLUS __cplusplus
#endif
#if VULKAN_HPP_CPLUSPLUS < 201103L
static_assert( false, "vulkan.hpp needs at least c++ standard version 11" );
#elif VULKAN_HPP_CPLUSPLUS < 201402L
# define VULKAN_HPP_CPP_VERSION 11
#elif VULKAN_HPP_CPLUSPLUS < 201703L
# define VULKAN_HPP_CPP_VERSION 14
#elif VULKAN_HPP_CPLUSPLUS < 202002L
# define VULKAN_HPP_CPP_VERSION 17
#else
# define VULKAN_HPP_CPP_VERSION 20
#endif
#include <algorithm>
#include <array>
#include <cstddef>
@ -7855,6 +7923,10 @@ int main( int argc, char ** argv )
#include <type_traits>
#include <vulkan/vulkan.h>
#if 17 <= VULKAN_HPP_CPP_VERSION
#include <string_view>
#endif
#if defined(VULKAN_HPP_DISABLE_ENHANCED_MODE)
# if !defined(VULKAN_HPP_NO_SMART_HANDLE)
# define VULKAN_HPP_NO_SMART_HANDLE

View File

@ -8,6 +8,24 @@
#ifndef VULKAN_HPP
#define VULKAN_HPP
#if defined( _MSVC_LANG )
# define VULKAN_HPP_CPLUSPLUS _MSVC_LANG
#else
# define VULKAN_HPP_CPLUSPLUS __cplusplus
#endif
#if VULKAN_HPP_CPLUSPLUS < 201103L
static_assert( false, "vulkan.hpp needs at least c++ standard version 11" );
#elif VULKAN_HPP_CPLUSPLUS < 201402L
# define VULKAN_HPP_CPP_VERSION 11
#elif VULKAN_HPP_CPLUSPLUS < 201703L
# define VULKAN_HPP_CPP_VERSION 14
#elif VULKAN_HPP_CPLUSPLUS < 202002L
# define VULKAN_HPP_CPP_VERSION 17
#else
# define VULKAN_HPP_CPP_VERSION 20
#endif
#include <algorithm>
#include <array>
#include <cstddef>
@ -21,6 +39,10 @@
#include <type_traits>
#include <vulkan/vulkan.h>
#if 17 <= VULKAN_HPP_CPP_VERSION
# include <string_view>
#endif
#if defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )
# if !defined( VULKAN_HPP_NO_SMART_HANDLE )
# define VULKAN_HPP_NO_SMART_HANDLE
@ -141,7 +163,7 @@ static_assert( VK_HEADER_VERSION == 144, "Wrong VK_HEADER_VERSION!" );
# endif
#endif
#if __cplusplus >= 201402L
#if 14 <= VULKAN_HPP_CPP_VERSION
# define VULKAN_HPP_DEPRECATED( msg ) [[deprecated( msg )]]
#else
# define VULKAN_HPP_DEPRECATED( msg )
@ -341,6 +363,56 @@ namespace VULKAN_HPP_NAMESPACE
{
return this->data();
}
template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>
operator std::string const() const VULKAN_HPP_NOEXCEPT
{
return std::string( this->data() );
}
#if 17 <= VULKAN_HPP_CPP_VERSION
template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>
operator std::string_view const() const VULKAN_HPP_NOEXCEPT
{
return std::string_view( this->data() );
}
#endif
template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>
bool operator<( ArrayWrapper1D<char, N> const & rhs ) const VULKAN_HPP_NOEXCEPT
{
return *static_cast<std::array<char, N> const *>( this ) < *static_cast<std::array<char, N> const *>( &rhs );
}
template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>
bool operator<=( ArrayWrapper1D<char, N> const & rhs ) const VULKAN_HPP_NOEXCEPT
{
return *static_cast<std::array<char, N> const *>( this ) <= *static_cast<std::array<char, N> const *>( &rhs );
}
template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>
bool operator>( ArrayWrapper1D<char, N> const & rhs ) const VULKAN_HPP_NOEXCEPT
{
return *static_cast<std::array<char, N> const *>( this ) > *static_cast<std::array<char, N> const *>( &rhs );
}
template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>
bool operator>=( ArrayWrapper1D<char, N> const & rhs ) const VULKAN_HPP_NOEXCEPT
{
return *static_cast<std::array<char, N> const *>( this ) >= *static_cast<std::array<char, N> const *>( &rhs );
}
template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>
bool operator==( ArrayWrapper1D<char, N> const & rhs ) const VULKAN_HPP_NOEXCEPT
{
return *static_cast<std::array<char, N> const *>( this ) == *static_cast<std::array<char, N> const *>( &rhs );
}
template <typename B = T, typename std::enable_if<std::is_same<B, char>::value, int>::type = 0>
bool operator!=( ArrayWrapper1D<char, N> const & rhs ) const VULKAN_HPP_NOEXCEPT
{
return *static_cast<std::array<char, N> const *>( this ) != *static_cast<std::array<char, N> const *>( &rhs );
}
};
// specialization of relational operators between std::string and arrays of chars