3 ms·
It's often used in libraries where you need to guarantee ABI compatibility. Fixing a bug or implementing a feature may require adding a new member into the clas
by dvratil 2mo ago
It's often used in libraries where you need to guarantee ABI compatibility. Fixing a bug or implementing a feature may require adding a new member into the class, which would change its size (thus break ABI compatibility). PIMPL is the typical solution here, since the inner/impl class is not part of the public ABI.
I also like to use it sometimes to "hide" private methods and their documentation into PIMPL, so the public header is kept clean.
- zabzonk 2mo ago> PIMPL is the typical solution here, since the inner/impl class is not part of the public ABI. Yep, that's what I've used it for. Didn't find it too difficult to implement it myself, but I guess every bit of convenience/bug avoidance helps.
- hasley 2mo agoYes, it is a good fit when a customer is supposed to use some functionality one has implemented but shall not see the implementation.