// --------------------
// interface (widget.h)
class widget
{
// public members
private:
struct impl; // forward declaration of the implementation class
// One implementation example: see below for other design options and trade-offs
std::experimental::propagate_const< // const-forwarding pointer wrapper
std::unique_ptr< // unique-ownership opaque pointer
impl>> pImpl; // to the forward-declared implementation class
};
// ---------------------------
// implementation (widget.cpp)
struct widget::impl
{
// implementation details
};