When we talk about dependencies, we usually think of run-time dependencies like class interactions. In this Item, we will focus instead on how to analyze and manage compile-time dependencies. As a first step, try to identify (and root out) unnecessary headers.
Many programmers habitually
#include many more headers than necessary. Unfortunately, doing so can seriously degrade build times, especially when a popular header file includes too many other headers.
In the following header file, which
#include directives could be immediately removed without ill effect? You may not make any changes other than removing or rewriting
#include directives. Note that the comments are important. ...