Commit a04e3a28 authored by T.J. Corona's avatar T.J. Corona

Explicitly delete copy ctor for move-only classes

When a class contains a member field that is move-only, MSVC2019
does not delete the implicit copy constructor and assignment
operator, preferring instead to error out with a cryptic message.
This MR explicitly removes the methods that should have been
implicitly removed by the compiler.
parent cec68b85
...@@ -62,6 +62,18 @@ public: ...@@ -62,6 +62,18 @@ public:
return smtk::shared_ptr<ItemDefinitionManager>(new ItemDefinitionManager(resourceManager)); return smtk::shared_ptr<ItemDefinitionManager>(new ItemDefinitionManager(resourceManager));
} }
// Our map of observer keys is move-only, so this class needs to be at least
// move-only as well. MSVC 2019 does not correctly intuit this fact when
// generating default constructors and assignment operators, so we explicitly
// remove them. We remove the move constructor and move assignment operator
// for good measure, since they are not needed anyway.
ItemDefinitionManager() = delete;
ItemDefinitionManager(const ItemDefinitionManager&) = delete;
ItemDefinitionManager(ItemDefinitionManager&&) = delete;
ItemDefinitionManager& operator=(const ItemDefinitionManager&) = delete;
ItemDefinitionManager& operator=(ItemDefinitionManager&&) = delete;
virtual ~ItemDefinitionManager(); virtual ~ItemDefinitionManager();
/// Register <CustomItemDefinitionType> to all attribute resources. /// Register <CustomItemDefinitionType> to all attribute resources.
......
...@@ -60,6 +60,18 @@ public: ...@@ -60,6 +60,18 @@ public:
return smtk::shared_ptr<Manager>(new Manager(resourceManager)); return smtk::shared_ptr<Manager>(new Manager(resourceManager));
} }
// Our map of observer keys is move-only, so this class needs to be at least
// move-only as well. MSVC 2019 does not correctly intuit this fact when
// generating default constructors and assignment operators, so we explicitly
// remove them. We remove the move constructor and move assignment operator
// for good measure, since they are not needed anyway.
Manager() = delete;
Manager(const Manager&) = delete;
Manager(Manager&&) = delete;
Manager& operator=(const Manager&) = delete;
Manager& operator=(Manager&&) = delete;
virtual ~Manager(); virtual ~Manager();
/// Register <QueryType> to all resources for which the input functor <fn> /// Register <QueryType> to all resources for which the input functor <fn>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment