[namespace.std] (original) (raw)
16 Library introduction [library]
16.4 Library-wide requirements [requirements]
16.4.5 Constraints on programs [constraints]
16.4.5.2 Namespace use [namespace.constraints]
16.4.5.2.1 Namespace std [namespace.std]
Unless otherwise specified, the behavior of a C++ program is undefined if it adds declarations or definitions to namespacestdor to a namespace within namespacestd.
Unless explicitly prohibited, a program may add a template specialization for any standard library class template to namespacestd provided that (a) the added declaration depends on at least one program-defined type and (b) the specialization meets the standard library requirements for the original template.177
The behavior of a C++ program is undefined if it declares an explicit or partial specialization of any standard library variable template, except where explicitly permitted by the specification of that variable template.
The behavior of a C++ program is undefined if it declares
- an explicit specialization of any member function of a standard library class template, or
- an explicit specialization of any member function template of a standard library class or class template, or
- an explicit or partial specialization of any member class template of a standard library class or class template, or
- a deduction guide for any standard library class template.
A program may explicitly instantiate a class template defined in the standard library only if the declaration (a) depends on the name of at least one program-defined type and (b) the instantiation meets the standard library requirements for the original template.
Let F denote a standard library function ([global.functions]), a standard library static member function, or an instantiation of a standard library function template.
Unless F is designated an addressable function, the behavior of a C++ program is unspecified (possibly ill-formed) if it explicitly or implicitly attempts to form a pointer to F.
Moreover, the behavior of a C++ program is unspecified (possibly ill-formed) if it attempts to form a reference to _F_or if it attempts to form a pointer-to-member designating either a standard library non-static member function ([member.functions]) or an instantiation of a standard library member function template.
Other than in namespace stdor in a namespace within namespace std, a program may provide an overload for any library function template designated as a customization point, provided that (a) the overload's declaration depends on at least one user-defined type and (b) the overload meets the standard library requirements for the customization point.178
[Note 2:
This permits a (qualified or unqualified) call to the customization point to invoke the most appropriate overload for the given arguments.
— _end note_]
A translation unit shall not declare namespace std to be an inline namespace ([namespace.def]).