6 Nov
2013
6 Nov
'13
5:38 p.m.
I've created a macro which automatically creates: - move constructor\assignment - swap member function - operator== and operator!= - operator< - assignment operator without side-effects if it throws. Example usage: class Foo { public: Foo() {} DEFAULT_EVERYTHING(Foo, ( (int)(a) ) ( (std::vector<int>)(b) ) ( (float)(c) ) ); }; Any interest, suggestions or ideas? Ofcourse it might be split into several macros depending on what operators the class requests (if it's a move-only class etc), and perhaps an extra parameter enable if a member is up for sorting and comparison. Code available here: https://www.dropbox.com/s/dhkxj94rrh83az0/DefaultEverything.h