Extend finding an enum value to also look for the aliases. (#1839)

This commit is contained in:
Andreas Süßenbach 2024-04-02 13:25:52 +02:00 committed by GitHub
parent 268fb77fb5
commit 8c9901c072
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -15496,13 +15496,17 @@ namespace
template <typename T>
typename std::vector<std::pair<std::string, T>>::const_iterator find( std::vector<std::pair<std::string, T>> const & values, std::string const & name )
{
return std::find_if( values.begin(), values.end(), [&name]( std::pair<std::string, T> const & value ) { return value.first == name; } );
return std::find_if( values.begin(),
values.end(),
[&name]( std::pair<std::string, T> const & value ) { return ( value.first == name ) || value.second.aliases.contains( name ); } );
}
template <typename T>
typename std::vector<std::pair<std::string, T>>::iterator find( std::vector<std::pair<std::string, T>> & values, std::string const & name )
{
return std::find_if( values.begin(), values.end(), [&name]( std::pair<std::string, T> const & value ) { return value.first == name; } );
return std::find_if( values.begin(),
values.end(),
[&name]( std::pair<std::string, T> const & value ) { return ( value.first == name ) || value.second.aliases.contains( name ); } );
}
std::string generateCArraySizes( std::vector<std::string> const & sizes )