Skip to content

Commit 8d7a1a7

Browse files
jensmaurerzygoloid
authored andcommitted
[class.mfct.non-static], [class.this] Define and use cv member function.
Fixes #447.
1 parent 1314cc4 commit 8d7a1a7

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

source/classes.tex

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,15 +1009,18 @@
10091009
\end{example}
10101010

10111011
\pnum
1012+
\indextext{member function!const}%
1013+
\indextext{member function!volatile}%
1014+
\indextext{member function!const volatile}%
10121015
A non-static member function may be declared \tcode{const},
10131016
\tcode{volatile}, or \tcode{const} \tcode{volatile}. These
10141017
\grammarterm{cv-qualifier}{s} affect the type of the \tcode{this}
10151018
pointer~(\ref{class.this}). They also affect the function
10161019
type~(\ref{dcl.fct}) of the member function; a member function declared
1017-
\tcode{const} is a \term{const} member function, a member function
1018-
declared \tcode{volatile} is a \term{volatile} member function and a
1020+
\tcode{const} is a \defn{const member function}, a member function
1021+
declared \tcode{volatile} is a \defn{volatile member function} and a
10191022
member function declared \tcode{const} \tcode{volatile} is a
1020-
\term{const volatile} member function.
1023+
\defn{const volatile member function}.
10211024
\begin{example}
10221025

10231026
\begin{codeblock}
@@ -1027,8 +1030,8 @@
10271030
};
10281031
\end{codeblock}
10291032

1030-
\tcode{X::g} is a \tcode{const} member function and \tcode{X::h} is a
1031-
\tcode{const} \tcode{volatile} member function.
1033+
\tcode{X::g} is a const member function and \tcode{X::h} is a
1034+
const volatile member function.
10321035
\end{example}
10331036

10341037
\pnum
@@ -1050,17 +1053,14 @@
10501053
\indextext{\idxcode{this}!type of}%
10511054
The type of \tcode{this} in a member function of a class \tcode{X} is
10521055
\tcode{X*}.
1053-
\indextext{member function!\idxcode{const}}%
10541056
If the member function is declared \tcode{const}, the type of
10551057
\tcode{this} is \tcode{const} \tcode{X*},
1056-
\indextext{member function!\idxcode{volatile}}%
10571058
if the member function is declared \tcode{volatile}, the type of
10581059
\tcode{this} is \tcode{volatile} \tcode{X*}, and if the member function
10591060
is declared \tcode{const} \tcode{volatile}, the type of \tcode{this} is
10601061
\tcode{const} \tcode{volatile} \tcode{X*}.
1061-
\indextext{member function!\idxcode{const}}%
1062-
\begin{note} Thus in a \tcode{const} member function, the object for which the function is
1063-
called is accessed through a \tcode{const} access path. \end{note}
1062+
\begin{note} Thus in a const member function, the object for which the function is
1063+
called is accessed through a const access path. \end{note}
10641064
\begin{example}
10651065

10661066
\begin{codeblock}
@@ -1076,14 +1076,14 @@
10761076

10771077
The \tcode{a++} in the body of \tcode{s::h} is ill-formed because it
10781078
tries to modify (a part of) the object for which \tcode{s::h()} is
1079-
called. This is not allowed in a \tcode{const} member function because
1079+
called. This is not allowed in a const member function because
10801080
\tcode{this} is a pointer to \tcode{const}; that is, \tcode{*this} has
10811081
\tcode{const} type.
10821082
\end{example}
10831083

10841084
\pnum
10851085
Similarly, \tcode{volatile} semantics~(\ref{dcl.type.cv}) apply in
1086-
\tcode{volatile} member functions when accessing the object and its
1086+
volatile member functions when accessing the object and its
10871087
non-static data members.
10881088

10891089
\pnum
@@ -1102,7 +1102,7 @@
11021102
\end{codeblock}
11031103

11041104
The call \tcode{y.g()} is ill-formed because \tcode{y} is \tcode{const}
1105-
and \tcode{s::g()} is a non-\tcode{const} member function, that is,
1105+
and \tcode{s::g()} is a non-const member function, that is,
11061106
\tcode{s::g()} is less-qualified than the object-expression \tcode{y}.
11071107
\end{example}
11081108

0 commit comments

Comments
 (0)