From 61c9a26d96c83d65f054961f4dae132e43c4b090 Mon Sep 17 00:00:00 2001 From: lyskov-ai <277346777+lyskov-ai@users.noreply.github.com> Date: Thu, 30 Apr 2026 13:38:51 -0400 Subject: [PATCH] Modernize copy prevention in Registrant to use = delete Replace old-style private-and-undefined copy constructor/assignment with explicit = delete. A comment explains the non-obvious reason: each constructor calls ProductFactory::add(), so a copy would silently re-register the same key. --- source/src/utility/factory/Registrant.hh | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/source/src/utility/factory/Registrant.hh b/source/src/utility/factory/Registrant.hh index 2a6663c0567..c7ad4495f08 100644 --- a/source/src/utility/factory/Registrant.hh +++ b/source/src/utility/factory/Registrant.hh @@ -48,13 +48,6 @@ public: // Types typedef typename ProductFactory::Create Create; // Product creation function -private: // Creation - - - /// @brief Copy constructor - Registrant( Registrant const & ); // Undefined - - public: // Creation @@ -175,12 +168,9 @@ public: // Creation } -private: // Assignment - - - /// @brief Copy assignment - Registrant & - operator =( Registrant const & ); // Undefined + // Each constructor calls ProductFactory::add(); a copy would silently re-register the same key. + Registrant( Registrant const & ) = delete; + Registrant & operator =( Registrant const & ) = delete; }; // Registrant