I want to make some classes use automatically generated constructors, but be non-copyable (but still movable). Currently I'm doing it like this:
class A
{
public:
A() = default;
A(const A&) = delete;
A(A&&) = default;
A& operator=(const A&) = delete;
A& operator=(A&&) = default;
}
I wonder if it's really necessary to be so explicit. What if I wrote it like this:
class A
{
A(const A&) = delete;
A& operator=(const A&) = delete;
}
Would it still work the same? What is the minimal set of defaults and deletes for other cases - non-copyable non-movable class, and class with virtual destructor?
Is there any test code I can use to quickly see which constructors are implicitly created?