Skip to content

Commit 19a0c06

Browse files
tkoeppezygoloid
authored andcommitted
[temp.class] Reorganize examples into a separate paragraph
1 parent 64e5cff commit 19a0c06

File tree

1 file changed

+10
-20
lines changed

1 file changed

+10
-20
lines changed

source/templates.tex

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,21 +1362,16 @@
13621362
\term{template}
13631363
defines the layout and operations
13641364
for an unbounded set of related types.
1365-
\begin{example}
1366-
a single class template
1367-
\tcode{List}
1368-
might provide a common definition for
1369-
list of
1370-
\tcode{int},
1371-
list of
1372-
\tcode{float},
1373-
and list of pointers to
1374-
\tcode{Shape}s.
1375-
\end{example}
13761365

1366+
\pnum
13771367
\begin{example}
1378-
An array class template might be declared like this:
1379-
1368+
A single class template
1369+
\tcode{List}
1370+
might provide an unbounded set of class definitions:
1371+
one class \tcode{List<T>} for every type \tcode{T},
1372+
each describing a linked list of elements of type \tcode{T}.
1373+
Similarly, a class template \tcode{Array} describing a contiguous,
1374+
dynamic array might be defined like this:
13801375
\begin{codeblock}
13811376
template<class T> class Array {
13821377
T* v;
@@ -1387,16 +1382,11 @@
13871382
T& elem(int i) { return v[i]; }
13881383
};
13891384
\end{codeblock}
1390-
1391-
\pnum
1392-
The prefix
1393-
\tcode{template}
1394-
\tcode{<class}
1395-
\tcode{T>}
1385+
The prefix \tcode{template<class T>}
13961386
specifies that a template is being declared and that a
13971387
\grammarterm{type-name}
13981388
\tcode{T}
1399-
will be used in the declaration.
1389+
may be used in the declaration.
14001390
In other words,
14011391
\tcode{Array}
14021392
is a parameterized type with

0 commit comments

Comments
 (0)