Check for duplicate registration.
This commit is contained in:
@@ -203,6 +203,10 @@ namespace Planets ::detail:: Generate_m
|
||||
void
|
||||
Generator::add( const std::string &name, std::unique_ptr< Generator > gen )
|
||||
{
|
||||
if( registry().count( name ) )
|
||||
{
|
||||
throw std::runtime_error( "Double registration of `" + name + "`" );
|
||||
}
|
||||
registry()[ name ]= std::move( gen );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user