Fact: Forward declarations (of class-types) are to be preferred over includes.
Is there a downside to forward-declaring everything in a header and including that header? (I’m guessing the compilation time shouldn’t increase by a lot)
In large codebases, forward-declarations can take up to a lot of screen-space, and it would be cool to replace them with a single include – however, it doesn’t make sense to have a forward-declaration header for each header with forward declarations.
Has anyone done this or seen this before?
I usually do so in my projects. But I split forward declarations in
modules. For example:gui,coreand so on. That gives a good balance between recompiling a lot because of using includes in headers and between writing forward declarations manually