diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index 1a58021..15e5899 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -10602,18 +10602,17 @@ std::string VulkanHppGenerator::generateStructConstructorsEnhanced( std::pair initializersList; + bool listedArgument = false; + bool arrayListed = false; + std::string templateHeader, sizeChecks, copyOps; for ( auto mit = structData.second.members.begin(); mit != structData.second.members.end(); ++mit ) { // gather the initializers if ( mit->name == "pNext" ) // for pNext, we just get the initializer... the argument is added at the end { - initializers += std::string( firstArgument ? ":" : "," ) + " pNext( pNext_ )"; - firstArgument = false; + initializersList.push_back( "pNext( pNext_ )" ); } else if ( mit->value.empty() ) // skip constant members { @@ -10621,8 +10620,7 @@ std::string VulkanHppGenerator::generateStructConstructorsEnhanced( std::pairname + "( " + generateLenInitializer( mit, litit, structData.second.mutualExclusiveLens ) + " )"; + initializersList.push_back( mit->name + "( " + generateLenInitializer( mit, litit, structData.second.mutualExclusiveLens ) + " )" ); sizeChecks += generateSizeCheck( litit->second, stripPrefix( structData.first, "Vk" ), structData.second.mutualExclusiveLens ); } else if ( hasLen( *mit ) ) @@ -10670,7 +10668,7 @@ std::string VulkanHppGenerator::generateStructConstructorsEnhanced( std::pairtype.isPointer() ) { - initializers += ( firstArgument ? ": " : ", " ) + mit->name + "( " + argumentName + ".data() )"; + initializersList.push_back( mit->name + "( " + argumentName + ".data() )" ); } else { @@ -10697,9 +10695,8 @@ std::string VulkanHppGenerator::generateStructConstructorsEnhanced( std::pairname + "( " + mit->name + "_ )"; + initializersList.push_back( mit->name + "( " + mit->name + "_ )" ); } - firstArgument = false; } } @@ -10711,6 +10708,16 @@ std::string VulkanHppGenerator::generateStructConstructorsEnhanced( std::pairtype.compose( "VULKAN_HPP_NAMESPACE" ) + " pNext_ = nullptr"; } + std::string initializers; + if ( !initializersList.empty() ) + { + initializers = ": " + initializersList[0]; + for ( size_t i = 1; i < initializersList.size(); ++i ) + { + initializers += ", " + initializersList[i]; + } + } + static const std::string constructorTemplate = R"( #if !defined( VULKAN_HPP_DISABLE_ENHANCED_MODE ) ${templateHeader} ${structName}( ${arguments} )