Skip to content

Commit a3afbc8

Browse files
jensmaurertkoeppe
authored andcommitted
Avoid \pnum inside examples. (#1262)
With the exception of [facets.examples]. Fixes #781.
1 parent 5d129b2 commit a3afbc8

File tree

7 files changed

+30
-31
lines changed

7 files changed

+30
-31
lines changed

source/access.tex

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,9 @@
116116
the class appearing outside the class's \grammarterm{member-specification}{.}
117117
\begin{note} This access also applies to implicit references to constructors,
118118
conversion functions, and destructors. \end{note}
119-
\begin{example}
120119

120+
\pnum
121+
\begin{example}
121122
\begin{codeblock}
122123
class A {
123124
typedef int I; // private member
@@ -140,7 +141,6 @@
140141
struct D: A::B, A { };
141142
\end{codeblock}
142143

143-
\pnum
144144
Here, all the uses of
145145
\tcode{A::I}
146146
are well-formed because
@@ -968,7 +968,6 @@
968968
};
969969
\end{codeblock}
970970

971-
\pnum
972971
Since
973972
\tcode{W::f()}
974973
is available to

source/basic.tex

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1843,11 +1843,13 @@
18431843
// overload resolution chooses \tcode{Z::h(double)}
18441844
}
18451845
\end{codeblock}
1846+
\end{example}
18461847

18471848
\pnum
1849+
\begin{note}
18481850
The same declaration found more than once is not an ambiguity (because
1849-
it is still a unique declaration). For example:
1850-
1851+
it is still a unique declaration).
1852+
\begin{example}
18511853
\begin{codeblock}
18521854
namespace A {
18531855
int a;
@@ -1885,8 +1887,11 @@
18851887
BD::a++; // OK: \tcode{S} is $\{ \text{\tcode{A::a}}, \text{\tcode{A::a}} \}$
18861888
}
18871889
\end{codeblock}
1890+
\end{example}
1891+
\end{note}
18881892

18891893
\pnum
1894+
\begin{example}
18901895
Because each referenced namespace is searched at most once, the
18911896
following is well-defined:
18921897

source/declarations.tex

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3918,14 +3918,12 @@
39183918
}
39193919
\end{codeblock}
39203920

3921-
\pnum
39223921
The \tcode{carries_dependency} attribute on function \tcode{f} means that the
39233922
return value carries a dependency out of \tcode{f}, so that the implementation
39243923
need not constrain ordering upon return from \tcode{f}. Implementations of
39253924
\tcode{f} and its caller may choose to preserve dependencies instead of emitting
39263925
hardware memory ordering instructions (a.k.a. fences).
39273926

3928-
\pnum
39293927
Function \tcode{g}'s second parameter has a \tcode{carries_dependency} attribute,
39303928
but its first parameter does not. Therefore, function \tcode{h}'s first call to
39313929
\tcode{g} carries a dependency into \tcode{g}, but its second call does not. The

source/derived.tex

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,10 @@
239239
corresponding distinct base class subobject of that type. For each
240240
distinct base class that is specified virtual, the most derived object
241241
shall contain a single base class subobject of that type.
242-
\begin{example}
243-
for an object of class type \tcode{C}, each distinct occurrence of a
242+
243+
\pnum
244+
\begin{note}
245+
For an object of class type \tcode{C}, each distinct occurrence of a
244246
(non-virtual) base class \tcode{L} in the class lattice of \tcode{C}
245247
corresponds one-to-one with a distinct \tcode{L} subobject within the
246248
object of type \tcode{C}. Given the class \tcode{C} defined above, an
@@ -253,7 +255,6 @@
253255
{fignonvirt.pdf}
254256
\end{importgraphic}
255257

256-
\pnum
257258
In such lattices, explicit qualification can be used to specify which
258259
subobject is meant. The body of function \tcode{C::f} could refer to the
259260
member \tcode{next} of each \tcode{L} subobject:
@@ -263,31 +264,33 @@
263264
Without the \tcode{A::} or \tcode{B::} qualifiers, the definition of
264265
\tcode{C::f} above would be ill-formed because of
265266
ambiguity~(\ref{class.member.lookup}).
267+
\end{note}
266268

267269
\pnum
268-
For another example,
270+
\begin{note}
271+
In contrast, consider the case with a virtual base class:
269272
\begin{codeblock}
270273
class V { @\commentellip@ };
271274
class A : virtual public V { @\commentellip@ };
272275
class B : virtual public V { @\commentellip@ };
273276
class C : public A, public B { @\commentellip@ };
274277
\end{codeblock}
275-
for an object \tcode{c} of class type \tcode{C}, a single subobject of
278+
\begin{importgraphic}
279+
{Virtual base}
280+
{fig:virt}
281+
{figvirt.pdf}
282+
\end{importgraphic}
283+
For an object \tcode{c} of class type \tcode{C}, a single subobject of
276284
type \tcode{V} is shared by every base subobject of \tcode{c} that has a
277285
\tcode{virtual} base class of type \tcode{V}. Given the class \tcode{C}
278286
defined above, an object of class \tcode{C} will have one subobject of
279287
class \tcode{V}, as shown in Figure~\ref{fig:virt}.
280-
281288
\indextext{DAG!multiple inheritance}%
282289
\indextext{DAG!virtual base class}%
283-
\begin{importgraphic}
284-
{Virtual base}
285-
{fig:virt}
286-
{figvirt.pdf}
287-
\end{importgraphic}
288-
290+
\end{note}
289291

290292
\pnum
293+
\begin{note}
291294
A class can have both virtual and non-virtual base classes of a given
292295
type.
293296
\begin{codeblock}
@@ -315,8 +318,7 @@
315318
{fig:virtnonvirt}
316319
{figvirtnonvirt.pdf}
317320
\end{importgraphic}
318-
319-
\end{example}
321+
\end{note}
320322

321323
\rSec1[class.member.lookup]{Member name lookup}%
322324
\indextext{lookup!member name}%

source/iostreams.tex

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12067,17 +12067,14 @@
1206712067
fs::create_directory(fs::u8path(utf8_string));
1206812068
\end{codeblock}
1206912069

12070-
\pnum
1207112070
For POSIX-based operating systems with the native narrow encoding set
1207212071
to UTF-8, no encoding or type conversion occurs.
1207312072

12074-
\pnum
1207512073
For POSIX-based operating systems with the native narrow encoding not
1207612074
set to UTF-8, a conversion to UTF-32 occurs, followed by a conversion to the
1207712075
current native narrow encoding. Some Unicode characters may have no native character
1207812076
set representation.
1207912077

12080-
\pnum
1208112078
For Windows-based operating systems a conversion from UTF-8 to
1208212079
UTF-16 occurs.
1208312080
\end{example}
@@ -13443,7 +13440,6 @@
1344313440
file3
1344413441
\end{codeblock}
1344513442

13446-
\pnum
1344713443
Calling \tcode{copy("/dir1", "/dir3")} would result in:
1344813444
\begin{codeblock}
1344913445
/dir1
@@ -13456,7 +13452,6 @@
1345613452
file2
1345713453
\end{codeblock}
1345813454

13459-
\pnum
1346013455
Alternatively, calling \tcode{copy("/dir1", "/dir3", copy_options::recursive)} would result in:
1346113456
\begin{codeblock}
1346213457
/dir1
@@ -14691,7 +14686,6 @@
1469114686
\begin{example} For POSIX-based operating systems, \tcode{system_complete(p)}
1469214687
has the same semantics as \tcode{absolute(p, current_path())}.
1469314688

14694-
\pnum
1469514689
For Windows-based operating systems, \tcode{system_complete(p)} has the
1469614690
same semantics as \tcode{absolute(p, current_path())} if
1469714691
\tcode{p.is_absolute() || !p.has_root_name()} or
@@ -14729,7 +14723,6 @@
1472914723
supplied by the first environment variable found in the list TMPDIR, TMP, TEMP, TEMPDIR,
1473014724
or if none of these are found, \tcode{"/tmp"}.
1473114725

14732-
\pnum
1473314726
For Windows-based operating systems, an implementation might return the path
1473414727
reported by the Windows \tcode{GetTempPath} API function.
1473514728
\end{example}

source/statements.tex

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,6 @@
475475
}
476476
\end{codeblock}
477477

478-
\pnum
479478
Thus after the \tcode{while} statement, \tcode{i} is no longer in scope.
480479
\end{example}
481480

source/templates.tex

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7513,6 +7513,7 @@
75137513
be given preference over a template specialization if the two functions
75147514
are otherwise equally good candidates for an overload match.}
75157515

7516+
\pnum
75167517
\begin{example}
75177518
\begin{codeblock}
75187519
template<class T> T max(T a, T b) { return a>b?a:b; }
@@ -7524,7 +7525,6 @@
75247525
}
75257526
\end{codeblock}
75267527

7527-
\pnum
75287528
Adding the non-template function
75297529

75307530
\begin{codeblock}
@@ -7540,8 +7540,10 @@
75407540
\tcode{int}
75417541
for
75427542
\tcode{c}.
7543+
\end{example}
75437544

75447545
\pnum
7546+
\begin{example}
75457547
Here is an example involving conversions on a function argument involved in
75467548
\grammarterm{template-argument}
75477549
deduction:
@@ -7556,8 +7558,10 @@
75567558
f(di); // \tcode{f((B<int>\&)di)}
75577559
}
75587560
\end{codeblock}
7561+
\end{example}
75597562

75607563
\pnum
7564+
\begin{example}
75617565
Here is an example involving conversions on a function argument not involved in
75627566
\grammarterm{template-parameter}
75637567
deduction:
@@ -7591,7 +7595,6 @@
75917595
}
75927596
\end{codeblock}
75937597

7594-
\pnum
75957598
The call of
75967599
\tcode{f}
75977600
is well-formed even if the template

0 commit comments

Comments
 (0)