| ▲ | jstimpfle 4 days ago | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Well that's a lie. I've long been back to raw pointers and it's by far the easiest way to do it. All of Pimpl, unique_ptr, and whatever other clever mechanism (I'm not even looking at std::indirect anymore) just aren't really ergonomic. Nobody needs "deep copying", ever. It's not even well defined what it should mean (i.e. how deep etc.). It's purely a theoretical problem with no good practical (one-fits-all) solution. The only practical way is to copy what you need copied, when you need it. Done. | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| ▲ | gblargg 4 days ago | parent | next [-] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
The whole point of pimpl is to store additional per-object state in a separate object (to reduce header dependencies). So it should act just like normal member variables for standard constructors and assignment. | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| ▲ | bluGill 4 days ago | parent | prev [-] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Easiest way to make a silly mistake and have your program break from memory safety errors. | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||