Default constructor generator

Answered

Hi,

while in Clion there is a shortcut to generate a default constructor, AFAIK there is nothing related to the other constructors (copy / copy assignment / move / move assignment / deconstructor). Obviously Clion could not implement any logic, but simply having the signature ready to me implemented would be a huge time saver. For instance, given the simplest class:

class A {}

this generator would create something like:

~A() {} // deconstructor
A(const
A& other) = default; // copy constructor
A&
operator=(const A& other) = default; // copy assignment
A(A&& other) noexcept = default; // move constructor
A
operator=(A&& other) noexcept = default; // move assignment

That's a lot of boilerplate and fixed "formulas" to remember. A shortcut to generate them all, and leave them ready to be implemented / removed would save lots of time.

3

Please sign in to leave a comment.