Named namespaces in Google Code Style
Namespaces wrap the entire source file after includes, gflags definitions/declarations and forward declarations of classes from other namespaces.
More complex .cc files might have additional details, like flags or using-declarations.
Do not declare anything in namespace std, including forward declarations of standard library classes. Declaring entities in namespace std is undefined behavior, i.e., not portable. To declare entities from the standard library, include the appropriate header file.
You may not use a using-directive to make all names from a namespace available.
You may use a using-declaration anywhere in a .cc file (including in the global namespace), and in functions, methods, classes, or within internal namespaces in .h files.
Do not use using-declarations in .h files except in explicitly marked internal-only namespaces, because anything imported into a namespace in a .h file becomes part of the public API exported by that file.
Namespace aliases are allowed anywhere where a using-declaration is allowed. In particular, namespace aliases should not be used at namespace scope in .h files except in explicitly marked internal-only namespaces.
Do not use inline namespaces.
Namespace discussion in Mesos
comments powered by