Open rperrot opened 1 year ago
I suggest to additionally provide generators for
I actually came by to mention a variation on this, it would even be useful to generate the block of standard defaults for all of these, even without definitions, to make it easy to explicitly default and/or delete constructors in a new class. This is actually one of my more time-consuming boilerplate tasks when working through modernizing code. For example, given the Test
class in the OP , generate default definitions could generate this in either the header or (with the class-name prefix) the implementation:
Test() = default;
Test(const Test &) = default;
Test(Test &&) = default;
operator=(const Test &) = default;
operator=(Test &&) = default;
~Test() = default;
Almost the same for declarations would also be great, just without the = ...
, for explicitly declaring that the constructors and destructor will be provided in an implementation file and avoiding the compiler generating them in all TUs:
Test();
Test(const Test &);
Test(Test &&);
operator=(const Test &);
operator=(Test &&);
~Test();
It feels like this would be easier than having to generate equivalent versions, and it would actually in some cases generate better code as long as the user can use c++11+.
Hi,
first of all, thank you for your extension.
I have two suggestions for new features :
Given a class like that :
It would be nice to have possibility to create definition for copy constructor and operator= :
And :
These operations are frequently error prone (missing argument, wrong initialization) and may be encountered frequently in old project (prior to C++11).
Yours.