From Jason Turner

[namespace.constraints]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpq2ndrqoc/{from.md → to.md} +53 -17
tmp/tmpq2ndrqoc/{from.md → to.md} RENAMED
@@ -1,16 +1,23 @@
1
  #### Namespace use <a id="namespace.constraints">[[namespace.constraints]]</a>
2
 
3
  ##### Namespace `std` <a id="namespace.std">[[namespace.std]]</a>
4
 
5
- The behavior of a C++program is undefined if it adds declarations or
6
- definitions to namespace `std` or to a namespace within namespace `std`
7
- unless otherwise specified. A program may add a template specialization
8
- for any standard library template to namespace `std` only if the
9
- declaration depends on a user-defined type and the specialization meets
10
- the standard library requirements for the original template and is not
11
- explicitly prohibited.[^21]
 
 
 
 
 
 
 
12
 
13
  The behavior of a C++ program is undefined if it declares
14
 
15
  - an explicit specialization of any member function of a standard
16
  library class template, or
@@ -18,30 +25,59 @@ The behavior of a C++program is undefined if it declares
18
  standard library class or class template, or
19
  - an explicit or partial specialization of any member class template of
20
  a standard library class or class template, or
21
  - a deduction guide for any standard library class template.
22
 
23
- A program may explicitly instantiate a template defined in the standard
24
- library only if the declaration depends on the name of a user-defined
25
- type and the instantiation meets the standard library requirements for
26
- the original template.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
  A translation unit shall not declare namespace `std` to be an inline
29
- namespace ([[namespace.def]]).
30
 
31
  ##### Namespace `posix` <a id="namespace.posix">[[namespace.posix]]</a>
32
 
33
  The behavior of a C++ program is undefined if it adds declarations or
34
  definitions to namespace `posix` or to a namespace within namespace
35
  `posix` unless otherwise specified. The namespace `posix` is reserved
36
  for use by ISO/IEC 9945 and other POSIX standards.
37
 
38
  ##### Namespaces for future standardization <a id="namespace.future">[[namespace.future]]</a>
39
 
40
- Top level namespaces with a name starting with `std` and followed by a
41
- non-empty sequence of digits are reserved for future standardization.
42
- The behavior of a C++program is undefined if it adds declarations or
43
- definitions to such a namespace.
44
 
45
- [*Example 1*: The top level namespace `std2` is reserved for use by
46
  future revisions of this International Standard. — *end example*]
47
 
 
1
  #### Namespace use <a id="namespace.constraints">[[namespace.constraints]]</a>
2
 
3
  ##### Namespace `std` <a id="namespace.std">[[namespace.std]]</a>
4
 
5
+ Unless otherwise specified, the behavior of a C++ program is undefined
6
+ if it adds declarations or definitions to namespace `std` or to a
7
+ namespace within namespace `std`.
8
+
9
+ Unless explicitly prohibited, a program may add a template
10
+ specialization for any standard library class template to namespace
11
+ `std` provided that (a) the added declaration depends on at least one
12
+ program-defined type and (b) the specialization meets the standard
13
+ library requirements for the original template.[^21]
14
+
15
+ The behavior of a C++ program is undefined if it declares an explicit or
16
+ partial specialization of any standard library variable template, except
17
+ where explicitly permitted by the specification of that variable
18
+ template.
19
 
20
  The behavior of a C++ program is undefined if it declares
21
 
22
  - an explicit specialization of any member function of a standard
23
  library class template, or
 
25
  standard library class or class template, or
26
  - an explicit or partial specialization of any member class template of
27
  a standard library class or class template, or
28
  - a deduction guide for any standard library class template.
29
 
30
+ A program may explicitly instantiate a class template defined in the
31
+ standard library only if the declaration (a) depends on the name of at
32
+ least one program-defined type and (b) the instantiation meets the
33
+ standard library requirements for the original template.
34
+
35
+ Let `F` denote a standard library function [[global.functions]], a
36
+ standard library static member function, or an instantiation of a
37
+ standard library function template. Unless `F` is designated an
38
+ *addressable function*, the behavior of a C++ program is unspecified
39
+ (possibly ill-formed) if it explicitly or implicitly attempts to form a
40
+ pointer to `F`.
41
+
42
+ [*Note 1*: Possible means of forming such pointers include application
43
+ of the unary `&` operator [[expr.unary.op]], `addressof`
44
+ [[specialized.addressof]], or a function-to-pointer standard conversion
45
+ [[conv.func]]. — *end note*]
46
+
47
+ Moreover, the behavior of a C++ program is unspecified (possibly
48
+ ill-formed) if it attempts to form a reference to `F` or if it attempts
49
+ to form a pointer-to-member designating either a standard library
50
+ non-static member function [[member.functions]] or an instantiation of a
51
+ standard library member function template.
52
+
53
+ Other than in namespace `std` or in a namespace within namespace `std`,
54
+ a program may provide an overload for any library function template
55
+ designated as a *customization point*, provided that (a) the overload’s
56
+ declaration depends on at least one user-defined type and (b) the
57
+ overload meets the standard library requirements for the customization
58
+ point. [^22]
59
+
60
+ [*Note 2*: This permits a (qualified or unqualified) call to the
61
+ customization point to invoke the most appropriate overload for the
62
+ given arguments. — *end note*]
63
 
64
  A translation unit shall not declare namespace `std` to be an inline
65
+ namespace [[namespace.def]].
66
 
67
  ##### Namespace `posix` <a id="namespace.posix">[[namespace.posix]]</a>
68
 
69
  The behavior of a C++ program is undefined if it adds declarations or
70
  definitions to namespace `posix` or to a namespace within namespace
71
  `posix` unless otherwise specified. The namespace `posix` is reserved
72
  for use by ISO/IEC 9945 and other POSIX standards.
73
 
74
  ##### Namespaces for future standardization <a id="namespace.future">[[namespace.future]]</a>
75
 
76
+ Top-level namespaces whose *namespace-name* consists of `std` followed
77
+ by one or more *digit*s [[lex.name]] are reserved for future
78
+ standardization. The behavior of a C++ program is undefined if it adds
79
+ declarations or definitions to such a namespace.
80
 
81
+ [*Example 1*: The top-level namespace `std2` is reserved for use by
82
  future revisions of this International Standard. — *end example*]
83