Skip Fallbacks::replaceImpl() when already correctly initialized (#494)

Do not reinitialize a Fallbacks' pimpl if it already serves the desired interface.
This commit is contained in:
Michael Görner 2023-10-11 14:45:24 +02:00 committed by GitHub
parent ab4bb40dfd
commit dcde89d4d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -876,6 +876,8 @@ void Fallbacks::onNewSolution(const SolutionBase& s) {
inline void Fallbacks::replaceImpl() {
FallbacksPrivate *impl = pimpl();
if (pimpl()->interfaceFlags() == pimpl()->requiredInterface())
return;
switch (pimpl()->requiredInterface()) {
case GENERATE:
impl = new FallbacksPrivateGenerator(std::move(*impl));