#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

namespace thing {
struct thing {
 int dummy;
 operator int (void) const {
  return dummy;
 }
 thing (int value) : dummy (value) {}
 thing (thing const & other) : dummy (other.dummy) {
  cout << "copy   " << this << " from " << &other << endl;
 }
 thing & operator=(thing const & other) {
  dummy = other.dummy;
  cout << "assign " << this << " from " << &other << endl;
 }
 void swap (thing & other) {
  cout << "ms " << this << " and " << &other << endl;
  internal_swap (other);
 }
 void internal_swap (thing & other) {
  auto temp = dummy;
  dummy = other.dummy;
  other.dummy = dummy;
 }
};

void swap (thing & lhs, thing & rhs) {
 cout << "fs " << &lhs << " and " << &rhs << endl;
 lhs.internal_swap(rhs);
}
}

int main() {
 vector<thing:: thing> data  = {1, 21, 42};
 cout << "sorting now" << endl;
 sort (begin (data), end (data), greater<int>{});
 return 0;
}