In fact, it is a handle, we cannot access its members of the object that handle refers to. On the other hand, we should not take care about its lifetime, the handle is just to provide a way to access the widget. So I chose trivial raw pointers to implement
The widgets can be allocated on the heap. e.g.
std::vector<std::shared_ptr<button> > buttons;
Sometimes, a form should be allocated on heap, but we don't make sure when the pointer should be deleted. E.g
A deprecated method looks like this. When the form is closed, delete the object.
form * p = new form;
It is dangerous. A right way is
form & fm = form_loader<form>()(/*specify the parameters for constructor of form here*/);
//do something for fm here