Re:Why I don't spend time with Modern C++ anymore
by aspiringuser on Thursday May 19, 2016 @06:56AM
(#11729259)
The heap allocation for the implementation won't be removed by LTO.
[ Parent
| on HN ]
Re:Why I don't spend time with Modern C++ anymore
by hellofunk on Thursday May 19, 2016 @07:27AM
(#11729368)
I'm inclined to agree that for objects that are going to be created and destroyed very often, especially in tight loops, PIMPL is not an ideal idiom. I wouldn't use it to generate fleeting effects in graphics, for example.
For objects that are used in setting up parts of a system and that will persist for long periods of time, maybe even the lifetime of the app, PIMPL is particularly well-suited for such classes. Classes that might manage networking, or encompass an entire part of app's running architecture, etc.
Re:Why I don't spend time with Modern C++ anymore
by hendzen on Thursday May 19, 2016 @11:30PM
(#11735399)
Thw complexity and overheead of PIMPL is justified in one scenario, and one scenario only - when you are writing a shared library and need to maintain a stable ABI. Otherwise it is complete overkill.