C++ Templates: Errata for the 5th and following Printings |
This is the errata of the 5th and the following
printings of the book C++
Templates by David
Vandevoorde and Nicolai
M. Josuttis.
The errata is organized in
the following way:
- The first part lists technical errors
- The second part lists typos (including stylistic changes
due to consistency etc.)
Page 47 (stack5assign.hpp),
Page 49 (stack6assign.hpp),
Page 54 (stack8.hpp):
In the templified assignment operator of Stack
the test of assignment to itself is useless because the template member assignment
operator is never used for assignment between objects of the same type, and
if the address of rhs ==
this, then the object must reasonably
be of the same type.
Page 138: s/typename D<T>::E e;/typename B<T>::E e;/
Page 305ff, Sections 17.3 and
17.4
The current implementations of Sqrt<>
don't handle 0 as argument. There
is no problem to handle it by defining the minimum/starting value as 0
instead of 1. As a consequence,
you might want to make the following modifications:
Page 305, sqrt1.hpp: s/int LO=1/int
LO=0/
Page 305: s/the square root is at least one/the square root is at least
zero/
Page 308, sqrt2.hpp: s/int LO=1/int
LO=0/
Page 310: s/for (I=1;/for
(I=0;/
Page 310, sqrt3.hpp: s/int I=1/int
I=0/
Page 311, sqrt4.hpp: s/int I=1/int
I=0/
However, note that the expandations discussed with this example change accordingly,
which means that the whole contents of this section has to be rewritten in some
way. Therefore, we will keep the contents of the book as it is.
Page 350ff, Section 19.2
We need additional partial specializations of CompoundT
for const and volatile pointer variants. Thus, for the sentence at the bottom
of page 350 introducing types/type3.hpp, add the following footnote:
The definitions of CompoundT<T* const>, CompoundT<T* volatile>, and CompoundT<T* const volatile> are omitted for brevity. They are identical to the definition of CompoundT<T*>.
Page 412, Section 21.3:
Figure 21.1 is (still) slightly incorrect. In the third box, the second type
has to be Tuple<int,float,double,NullT,NullT>::BaseT.
Thus, insert int before float
and remoive one NullT.
Page 501, [CargillExceptionSafety]:
The new URL for this article in C++ Report 1994 is: http://www.quut.com/c/c-www/cargill-on-exception.html
Page 5 (and TOC): s/1.6 Example Code and Additional Informations/1.6 Example Code and Additional Information/
Page 127: s/C<void> b;/C<void>* b;/
Page 157: s/that meant that it (1) used the/that meant that it (a) used the/
Page 158, footnote 12: s/publically available/publicly available/
Page 208 top: s/MyInt j = count<MyInt>(c);/MyInt j = count<Container, MyInt>(c);/
Page 307: s/(16<=8*8)/(16<9*9)/
Page 326: s/template<class T>/template<typename T>/ (three times)
Page 431 (22.5.2): s/bool my_criterion()(T const& x, T const&y)/bool my_criterion(T const& x, T const&y)/
Page 448 functors/compose2.cpp: s/Compose(Abs(),Sine())(0.5)/Compose(Abs(),Sine())(-0.5)/
Page 515 two-phase lookup: s/but
during the first phase nondependent base classes are not considered/but
during the first phase dependent base classes are not considered/