Extend check for function pointers on creating compare operators of structs. (#1348)

This commit is contained in:
Andreas Süßenbach 2022-07-07 11:41:43 +02:00 committed by GitHub
parent 9748e47228
commit fac74444fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9050,20 +9050,22 @@ std::string VulkanHppGenerator::generateStructCompareOperators( std::pair<std::s
std::string compareBody, spaceshipOperator, spaceshipOperatorIf, spaceshipOperatorElse, spaceshipOperatorEndif;
if ( nonDefaultCompare )
{
assert( !containsFuncPointer( structData.first ) );
compareBody = " return " + compareMembers + ";";
static const std::string spaceshipOperatorTemplate =
R"( ${ordering} operator<=>( ${name} const & rhs ) const VULKAN_HPP_NOEXCEPT
if ( !containsFuncPointer( structData.first ) )
{
static const std::string spaceshipOperatorTemplate =
R"( ${ordering} operator<=>( ${name} const & rhs ) const VULKAN_HPP_NOEXCEPT
{
${spaceshipMembers}
return ${ordering}::equivalent;
})";
spaceshipOperatorIf = "#if defined(VULKAN_HPP_HAS_SPACESHIP_OPERATOR)";
spaceshipOperator =
replaceWithMap( spaceshipOperatorTemplate, { { "name", structName }, { "ordering", spaceshipOrdering }, { "spaceshipMembers", spaceshipMembers } } );
spaceshipOperatorElse = "#endif\n";
spaceshipOperatorEndif = "";
spaceshipOperatorIf = "#if defined(VULKAN_HPP_HAS_SPACESHIP_OPERATOR)";
spaceshipOperator =
replaceWithMap( spaceshipOperatorTemplate, { { "name", structName }, { "ordering", spaceshipOrdering }, { "spaceshipMembers", spaceshipMembers } } );
spaceshipOperatorElse = "#endif\n";
spaceshipOperatorEndif = "";
}
}
else
{