From Jason Turner

[class.mfct]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp4xyap4sz/{from.md → to.md} +9 -44
tmp/tmp4xyap4sz/{from.md → to.md} RENAMED
@@ -1,41 +1,13 @@
1
  ### Member functions <a id="class.mfct">[[class.mfct]]</a>
2
 
3
- A member function may be defined [[dcl.fct.def]] in its class
4
- definition, in which case it is an inline [[dcl.inline]] member function
5
- if it is attached to the global module, or it may be defined outside of
6
- its class definition if it has already been declared but not defined in
7
- its class definition.
8
 
9
  [*Note 1*: A member function is also inline if it is declared `inline`,
10
  `constexpr`, or `consteval`. — *end note*]
11
 
12
- A member function definition that appears outside of the class
13
- definition shall appear in a namespace scope enclosing the class
14
- definition. Except for member function definitions that appear outside
15
- of a class definition, and except for explicit specializations of member
16
- functions of class templates and member function templates [[temp.spec]]
17
- appearing outside of the class definition, a member function shall not
18
- be redeclared.
19
-
20
- [*Note 2*: There can be at most one definition of a non-inline member
21
- function in a program. There may be more than one inline member function
22
- definition in a program. See  [[basic.def.odr]] and 
23
- [[dcl.inline]]. — *end note*]
24
-
25
- [*Note 3*: Member functions of a class have the linkage of the name of
26
- the class. See  [[basic.link]]. — *end note*]
27
-
28
- If the definition of a member function is lexically outside its class
29
- definition, the member function name shall be qualified by its class
30
- name using the `::` operator.
31
-
32
- [*Note 4*: A name used in a member function definition (that is, in the
33
- *parameter-declaration-clause* including the default arguments
34
- [[dcl.fct.default]] or in the member function body) is looked up as
35
- described in  [[basic.lookup]]. — *end note*]
36
-
37
  [*Example 1*:
38
 
39
  ``` cpp
40
  struct X {
41
  typedef int T;
@@ -43,30 +15,23 @@ struct X {
43
  void f(T);
44
  };
45
  void X::f(T t = count) { }
46
  ```
47
 
48
- The member function `f` of class `X` is defined in global scope; the
49
- notation `X::f` specifies that the function `f` is a member of class `X`
50
- and in the scope of class `X`. In the function definition, the parameter
51
- type `T` refers to the typedef member `T` declared in class `X` and the
52
- default argument `count` refers to the static data member `count`
53
- declared in class `X`.
54
 
55
  — *end example*]
56
 
57
- [*Note 5*: A `static` local variable or local type in a member function
58
- always refers to the same entity, whether or not the member function is
59
- inline. — *end note*]
60
-
61
- Previously declared member functions may be mentioned in friend
62
- declarations.
63
-
64
  Member functions of a local class shall be defined inline in their class
65
  definition, if they are defined at all.
66
 
67
- [*Note 6*:
68
 
69
  A member function can be declared (but not defined) using a typedef for
70
  a function type. The resulting member function has exactly the same type
71
  as it would have if the function declarator were provided explicitly,
72
  see  [[dcl.fct]]. For example,
 
1
  ### Member functions <a id="class.mfct">[[class.mfct]]</a>
2
 
3
+ If a member function is attached to the global module and is defined
4
+ [[dcl.fct.def]] in its class definition, it is inline [[dcl.inline]].
 
 
 
5
 
6
  [*Note 1*: A member function is also inline if it is declared `inline`,
7
  `constexpr`, or `consteval`. — *end note*]
8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  [*Example 1*:
10
 
11
  ``` cpp
12
  struct X {
13
  typedef int T;
 
15
  void f(T);
16
  };
17
  void X::f(T t = count) { }
18
  ```
19
 
20
+ The definition of the member function `f` of class `X` inhabits the
21
+ global scope; the notation `X::f` indicates that the function `f` is a
22
+ member of class `X` and in the scope of class `X`. In the function
23
+ definition, the parameter type `T` refers to the typedef member `T`
24
+ declared in class `X` and the default argument `count` refers to the
25
+ static data member `count` declared in class `X`.
26
 
27
  — *end example*]
28
 
 
 
 
 
 
 
 
29
  Member functions of a local class shall be defined inline in their class
30
  definition, if they are defined at all.
31
 
32
+ [*Note 2*:
33
 
34
  A member function can be declared (but not defined) using a typedef for
35
  a function type. The resulting member function has exactly the same type
36
  as it would have if the function declarator were provided explicitly,
37
  see  [[dcl.fct]]. For example,