#include <memory>
#include <vector>
#include <boost/variant.hpp>

using namespace std;

class holder;
struct v_with_holder {
	// a bunch of fields
    std::unique_ptr<holder> ph;
    holder& h;
    
    friend void swap(v_with_holder& first, v_with_holder& second) 
    {
    	using std::swap;
    	// swap a bunch of fields
    	swap(first.ph, second.ph);
    }
    
    v_with_holder(); 
    ~v_with_holder();
    v_with_holder(const v_with_holder& other);
    v_with_holder(v_with_holder&& other);
    v_with_holder& operator=(v_with_holder other);
};

typedef boost::variant</* such types, */v_with_holder/*, many others */> struct_v;

class holder { public: std::vector<struct_v> ss; };

v_with_holder::v_with_holder() : ph(new holder), h(*ph) { }
v_with_holder::~v_with_holder() { }
v_with_holder::v_with_holder(const v_with_holder& other) : ph(new holder), h(*ph)
{
	// copy a bunch of fields
	h = other.h;
}
v_with_holder::v_with_holder(v_with_holder&& other) : v_with_holder()
{
	swap(*this, other);
}
v_with_holder& v_with_holder::operator=(v_with_holder other)
{
	swap(*this, other);
	return *this;
}

int main() {
	holder h1, h2;
	v_with_holder x;
	x.h = h2;
	h1.ss.push_back(x);
	return 0;
}
