@ -18207,6 +18207,7 @@ Source file rule summary:
* [SF.8: Use `#include` guards for all `.h` files ](#Rs-guards )
* [SF.8: Use `#include` guards for all `.h` files ](#Rs-guards )
* [SF.9: Avoid cyclic dependencies among source files ](#Rs-cycles )
* [SF.9: Avoid cyclic dependencies among source files ](#Rs-cycles )
* [SF.10: Avoid dependencies on implicitly `#include`d names ](#Rs-implicit )
* [SF.10: Avoid dependencies on implicitly `#include`d names ](#Rs-implicit )
* [SF.11: Header files should be self-contained ](#Rs-contained )
* [SF.20: Use `namespace`s to express logical structure ](#Rs-namespace )
* [SF.20: Use `namespace`s to express logical structure ](#Rs-namespace )
* [SF.21: Don't use an unnamed (anonymous) namespace in a header ](#Rs-unnamed )
* [SF.21: Don't use an unnamed (anonymous) namespace in a header ](#Rs-unnamed )
@ -18614,6 +18615,27 @@ This rule against implicit inclusion is not meant to prevent such deliberate agg
Enforcement would require some knowledge about what in a header is meant to be "exported" to users and what is there to enable implementation.
Enforcement would require some knowledge about what in a header is meant to be "exported" to users and what is there to enable implementation.
No really good solution is possible until we have modules.
No really good solution is possible until we have modules.
### < a name = "Rs-contained" > < / a > SF.11: Header files should be self-contained
##### Reason
Usability, headers should be simple to use and work when included on their own.
Headers should encapsulate the functionality they provide.
Avoid clients of a header having to manage that header's dependencies.
##### Example
#include "helpers.h"
// helpers.h depends on std::string and includes < string >
##### Note
Failing to follow this results in difficult to diagnose errors for clients of a header.
##### Enforcement
A test should verify that the header file itself compiles or that a cpp file which only includes the header file compiles.
### < a name = "Rs-namespace" ></ a > SF.20: Use `namespace` s to express logical structure
### < a name = "Rs-namespace" ></ a > SF.20: Use `namespace` s to express logical structure
##### Reason
##### Reason