Nicolai M. Josuttis: solutions in time  Object-Oriented Programming in C++: Errata

Object-Oriented Programming in C++

Apr 19, 2004

This is the errata of the book Object-Oriented Programming in C++ by Nicolai M. Josuttis.
The errata is organized in the following way:
- The first part lists technical errors
- The second part lists typos


Page 90, Section 3.5.9, stl/ioiter1.cpp
This example does not compile on all platforms because there is an additional include statement for the stream iterators missing:
    #include <iterator>

Page 164, Section 4.2.6
In the paragraph after the example declaration of prefix and postfix increment operator, the explanations of the meaning are wrong. It has to be the other way round:

... while the first returns the value of the object after it was incremented and the second returns the object before it is incremented.

Page 442, Section 7.3.3
The second sentence claiming that every member function of a specialization must begin with template<> is wrong. Member functions like Stack<std::string>::push() are defined without a leading template<> (as the code in tmpl/stack2.hpp shows).

Page 455, Section 7.5.2
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.

Pages 440, 446, 450, 465
Because the Stack class throws std::out_of_range exception the test programs should be changed from:
    catch (const char* msg) {
        std::cerr << "Exception: " << msg << std::endl;

    catch (const std::exception& e) {
        std::cerr << "Exception: " << e.what()<< std::endl;

Page 526,
Replace the paragraph starting with "Some of these algorithms ..." by the following:
"The _if suffix is used when you can call two forms of an algorithm that have the same number of parameters either by passing a value or by passing a function. In this case, the version without the suffix is used for values, and the version with the _if suffix is used for functions. However, not all algorithms that have a parameter for functions have the _if suffix. When the function version of an algorithm has an additional argument, it has the same name."

Page 530, Table 9.14:
upper_bound() returns the first element that is greater than a value.

Page 531, Table 9.16:
min() returns the minimum value of the type (has meaning if is_bounded||!is_signed).

Page 570/571, Section 10.1
Unfortunately not all horizontal lines are visible in the table. Whenever there is an "Eval." entry in a row, starts a new group of operators with the same priority. Thus, a horizontal line is missing below the following operators: ->* % >> & ^ && || |=


Page 11: s/current mileage as floating-point values/current mileage as a floating-point value/

Page 13: s/all members of them/all their members/

Page 21: s/elements,and/element, and/

Page 48: s/"crosscross.hpp"/"cross.hpp"/

Page 51: s/two thjings are remarkable/two things are remarkable/

Page 59: s/create two strings/create three strings/

Page 93: s/memory can be used/a request for memory cannot be satisfied,/

Page 127: s/involves transform this kind of ... to already available types/involves transforming this kind of ... to types already available/

Page 150: s/constructor from int (denominator)/constructor from int (numerator)/

Page 153: s/simply mulitply inequality by numerator/simply multiply inequality by denominator/

Page 157: s/must alsways define/must always define/

Page 160: s/multiply x by a/multiply x by w/

Page 161: s/Instead, all operators are parameters./Instead, all operands are parameters./

Page 166: s/calling operation () for object a/calling operator () for object a/

Page 166: s/in fact, a[] is the call/in fact, a() is the call/

Page 167: s/corresponds to p[0]/corresponds to p[0].k/

Page 181: s/For this reason, th term/For this reason, the term/

Page 181: s/b is a local copy of the second operand/f is a local copy of the second operand/

Page 191 (classes/ftest4.cpp): s/output fraction a/output fraction w/

Page 191: s/Here, print( ) can only be called for the fraction constant a because/
Here, print( ) can be called for the constant fraction w only because/

Page 192: s/ip = 33;/*ip = 33;/

Page 218: s/one-parameter constructor defines an automatic type conversion/ability to call constructor with one parameter defines automatic type conversion/

Page 227: s/return a *= b;/return result *= b;/

Page 235 (classes/frac8.hpp): s/two-paramter/two-parameter/

Page 252: s/serios impact/serious impact/

Page 255: s/polymorphism is implemented is C++/polymorphism is implemented in C++/

Page 266: s/Therefore, a numerator and a denominator can be passed as an integer./Therefore, a numerator and a denominator can each be passed as an integer./

Page 280: s/does not which functions/does not know which functions/

Page 283: s/at run time, it is decided/at run time, it is to be decided/

Page 293: s/incorrect default value/wrong default value/

Page 295: s/If the function of the base class is still to be usable, it must be
redefined:/To override without overlapping, you must redefine the derived member function again:/

Page 313 (inherit/geotest1.cpp): s/for (int i=0; i<3; i++)/for (int i=0; i<3; ++i)/

Page 329: s/These are usually name conflicts/There are usually name conflicts/

Page 340 (Figure 5.12): s/Vehcile/Vehicle/

Page 349: s/if inherited get a different meaning/if inherited members get a different meaning/

Page 390: s/plain type meanwhile it is declared/plain type where it is declared/

Page 396: s/being virtual, inline processing/if it is virtual, inline processing/

Page 400: s/which you might would cause problems/which would cause problems/

Page 400: s/than user-defined functions, such as constructors and conversion functions/than a conversion defined by a constructor or conversion function/

Page 404: s/in a way, that/in a way that/

Page 404: s/base class, without/base class without/

Page 417: s/th static/the static/

Page 417: s/are only ever declared./are only declared./

Page 429: s/return a > b ? a : b;/return a < b ? b : a;/

Page 437: s/by an statement/by a statement/

Page 473: s/but they delegate special classes/but they delegate to special classes/

Page 478: s/int readsome (char* cs, int num/int readsome (char* cs, int num)/

Page 504: s/funstions/functions/

Page 515: s/using freeze()/calling freeze(false)/

Page 515: s/calling freeze()/calling freeze(false)/

Page 515: s/append and end-of-string/append an end-of-string/

Page 534: s/static T min() throw() {/static int min() throw() {/
Page 534: s/
static T max() throw() {/static int max() throw() {/

Page 538(fist line): s/++*count;/--*count;/

Page 545: /acn be used/can be used/

Page 550: s/use emerengy memory/use emergency memory/

Page 558: s/if (MyNewHandler != 0) {/if (myNewHandler != 0) {/

In addition, in

classes/frac2.cpp (page 154)
(page 171)
classes/frac4.cpp (page 190)
classes/frac5.cpp (page 212)
classes/frac6.cpp (page 226)
classes/frac8.cpp (page 238)

s/since the numerator cannot be negative/because the denominator cannot be negative/

Home of the OOP in C++ book