Skip to content

Commit 4ce0542

Browse files
committed
[depr.capture.this] Reorder so the order of Annex D matches the order of the main text
1 parent 628a32d commit 4ce0542

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

source/future.tex

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,25 @@
1414
An implementation may declare library names and entities described in this Clause with the
1515
\tcode{deprecated} attribute\iref{dcl.attr.deprecated}.
1616

17+
\rSec1[depr.capture.this]{Implicit capture of \tcode{*this} by reference}
18+
19+
\pnum
20+
For compatibility with prior \Cpp{} International Standards,
21+
a lambda expression with \grammarterm{capture-default}
22+
\tcode{=}\iref{expr.prim.lambda.capture} may implicitly capture
23+
\tcode{*this} by reference.
24+
\begin{example}
25+
\begin{codeblock}
26+
struct X {
27+
int x;
28+
void foo(int n) {
29+
auto f = [=]() { x = n; }; // deprecated: \tcode{x} means \tcode{this->x}, not a copy thereof
30+
auto g = [=, this]() { x = n; }; // recommended replacement
31+
}
32+
};
33+
\end{codeblock}
34+
\end{example}
35+
1736
\rSec1[depr.static_constexpr]{Redeclaration of \tcode{static constexpr} data members}
1837

1938
\pnum
@@ -48,25 +67,6 @@
4867
\pnum
4968
The \grammarterm{noexcept-specifier} \tcode{throw()} is deprecated.
5069

51-
\rSec1[depr.capture.this]{Implicit capture of \tcode{*this} by reference}
52-
53-
\pnum
54-
For compatibility with prior \Cpp{} International Standards,
55-
a lambda expression with \grammarterm{capture-default}
56-
\tcode{=}\iref{expr.prim.lambda.capture} may implicitly capture
57-
\tcode{*this} by reference.
58-
\begin{example}
59-
\begin{codeblock}
60-
struct X {
61-
int x;
62-
void foo(int n) {
63-
auto f = [=]() { x = n; }; // deprecated: \tcode{x} means \tcode{this->x}, not a copy thereof
64-
auto g = [=, this]() { x = n; }; // recommended replacement
65-
}
66-
};
67-
\end{codeblock}
68-
\end{example}
69-
7070
\rSec1[depr.cpp.headers]{\Cpp{} standard library headers}
7171

7272
\pnum

0 commit comments

Comments
 (0)