Directly Include Referenced Declarations

This algorithm works only on a single file and not on a whole project.
Directly including referenced files will suggest to add an include statement to each header file that defines a type that is used in a file under consideration.
This will alter the include structure of a project in favor of the reduction of include dependencies, coupling and compile time.

A detailed description why directly directly including referenced files is useful can be found in the book Large-Scale C++ Software Design (http://www.cs.unc.edu/~stotts/COMP204/lakos/) by John Lakos on page 113.

As an example, consider the following C++ project graph:

Note that the blue relations (arrows) between the files (boxes) represent include statements in the originating file which includes the target file. Red dashed arrows represent dependencies to declared types in header files.

The result when running the algorithm on the file main.cpp and then on the file other.cpp is shown below.