Organize Includes

The “Organize Includes” feature is similar to the “Organize Imports” feature found in Eclipse JDT and performs a similar task. The purpose of the “Organize Includes” feature is to analyze a given file and identify any includes that should be added or removed. By doing this, the feature can help to ensure that all necessary dependencies are included in the file, while also removing any unnecessary includes that may be cluttering the code. One of the key benefits of the “Organize Includes” feature is that it can help to reduce the overall size of the codebase. This can be particularly important in large-scale projects, where the number of includes can quickly become unmanageable. By removing unnecessary includes, developers can improve the efficiency of the compilation process, as well as make the codebase more readable and easier to maintain. Overall, the “Organize Includes” feature is a valuable tool for any C++ developer, and can help to streamline the coding process while improving the quality of the codebase. By keeping the codebase clean and well-organized, developers can ensure that their code is more efficient, easier to maintain, and less prone to errors and bugs.

Example

  /* main.cpp */
#include "Y.h" 
#include "Z.h
int main() {
  Y y;
  X x;
  return 0;
}
  /* X.h */
class X { };
  /* Y.h */
class Y { };
  /* Z.h */
class Z { };

Here, the Includator makes the proposal to to include file X.h and to remove the include of Z.h.