I want to write a C++ class without any copy and move semantics: I'm just interested in its constructor and destructor.
I disabled copy operations (i.e. copy constructor and copy assignment operator) explicitly using C++11's =delete
syntax, e.g.:
class MyClass
{
public:
MyClass() { /* Init something */ }
~MyClass() { /* Cleanup something */ }
// Disable copy
MyClass(const MyClass&) = delete;
MyClass& operator=(const MyClass&) = delete;
};
As a test, I tried calling std::move()
on class instances, and it seems that there are no move operations automatically generated, as the Visual Studio 2015 C++ compiler emits error messages.
Is this a behavior specific to MSVC 2015, or is it dictated by the C++ standard that disabling via =delete
copy operations automatically disables move constructor and move assignment?