(no title)
McKayDavis | 4 years ago
> * Forward-declare as much as you can. Forward type declarations mean that the compiler doesn't need to process all of `Foo` when it sees `Foo&` or `Foo`.
I've found the include-what-you-use (IWYU) tool [1][2] can help immensely with automating this process, especially on large code-bases.
It uses LLVM/Clang to analyze a .cpp file / translation unit and produces the minimal subset of exactly which includes are necessary and what types can be forward declared.
[1] https://include-what-you-use.org/
[2] https://github.com/include-what-you-use/include-what-you-use
No comments yet.