widget.h:
class Widget
{
public:
Widget();
~Widget();
// ... other funcs
Widget(const Widget& rhs); /
Widget& operator=(const Widget& rhs);
private:
struct Impl;
std::unique_ptr<Impl> pImpl;
};
widget.cpp:
struct Widget::Impl
{
std::string name;
std::vector<double> data;
Gadget g1,g2,g3;
};
Widget::Widget() : pImpl(std::make_unique<Impl>())
{}
Widget::~Widget(){} // or Widget::~Widget()=default;
Widget::Widget(Widget&& rhs) = default;
Widget& Widget::operator=(Widget&& rhs) = default;