Say we have this header file:
#pragma once
#include
class MyClass
{
public:
MyClass(double);
/* ... */
private:
You should use explicit #include
s to have a non destructive workflow. Let's say that MyClass
is used in 50 different source files. They don't include vector
. Suddenly, you have to change std::vector
in MyClass.h
for some other container. Then all the 50 source files will either need to include vector
or you will need to leave it in MyClass.h
.
This would be redundant and it could increase application size, compilation time and even run time (static variable initialization) unnecessarily.