Boost logo

Boost :

Subject: [boost] [utility] Any interest for a macro which automatically creates default move-semantics, comparisson etc for a class
From: Viktor Sehr (viktor.sehr_at_[hidden])
Date: 2013-11-06 12:38:44

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 {
  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:

Boost list run by bdawes at, gregod at, cpdaniel at, john at