Hacker News new | ask | show | jobs
by feverzsj 5 days ago
Yes, if you actually care compile times.
3 comments

Indeed. I primarily used PIMPL when I want to avoid polluting public header files with implementation detail #includes in cases where forward declarations are impossible or unwieldy and inline methods are irrelevant.
My approach to reducing the compile time of code which uses a class is moving the functionality out of the class and into standalone functions; or at least moving the method definitions into a non-header `.cpp` file.
Lucky for you, I don't.