Modified August 19, 2004
Errata for Bjarne Stroustrup: The C++ Programming Language (special edition), Addison-Wesley, 2000. ISBN0-201-70073-5. Errata for the 9th printing yielding the 10th printing. Also for the 19th printing of "The C++ Programming Language (3rd edition).
Chapter 4:
pp78-79
typedef complex<short> Point;is (just) a declaration and not a definition.
Chapter 6:
pg 121 s/Unary operators/Prefix operators/
Chapter 8:
pg 183 s/names names/names/
Chapter 10:
p6 253 /class Zlib_init/struct Zlib_init/
Chapter 14:
pg 368 The revised ISO standard auto_ptr reads like this:
template<class Y> struct auto_ptr_ref { /* ... */ }; // helper class template<class X> class auto_ptr { X* ptr; public: typedef X element_type; // note copy constructors and assignments take non-const arguments: explicit auto_ptr(X* p =0) throw() { ptr=p; } // throw() means "throws nothing;" see _except.spec_ auto_ptr(auto_ptr& a) throw(); // copy, then a.ptr=0 template<class Y> auto_ptr(auto_ptr<Y>& a) throw(); // copy, then a.ptr=0 ~auto_ptr() throw() { delete ptr; } auto_ptr& operator=(auto_ptr& a) throw(); // copy, then a.ptr=0 template<class Y> auto_ptr& operator=(auto_ptr<Y>& a) throw(); // copy, then a.ptr=0 template<class Y> auto_ptr& operator=(auto_ptr_ref<Y>& a) throw(); // copy, then release X& operator*() const throw() { return *ptr; } X* operator->() const throw() { return ptr; } X* get() const throw() { return ptr; } // extract pointer X* release() throw() { X* t = ptr; ptr=0; return t; } // relinquish ownership void reset(X* p =0) throw() { if (p!=ptr) { delete ptr; ptr=p; } } auto_ptr(auto_ptr_ref<X>) throw(); // copy from auto_ptr_ref template<class Y> operator auto_ptr_ref<Y>() throw(); // copy to auto_ptr_ref template<class Y> operator auto_ptr<Y>() throw(); // destructive copy from auto_ptr };
Chapter 19:
pg 564 index() should be:
difference_type index() const { return curr-c->begin(); } // random-access only
Chapter 22:
pg 665 The revised Standard valarray reads like this:
valarray operator-() const; // result[i] = -v[i] for every element // similarly: + and ~ valarray<bool> operator!() const; // result[i] = !v[i] for every element
pg 675 s/This would also work(22.9[10]). However,/However, valarray is only guaranteed to work with scalar elements, so we'd have to use something like vector< vector<double> > v, and/
pg 687 Replace exercise 10 by "Implement Matrix using a vector< vector<double> > as the representation (rather than a pointer to a valarray."
Appendix A:
Appendix C:
pg 879 s/locale& old_global/locale old_global/