home | C++ | FAQ | technical FAQ | publications | WG21 papers | TC++PL | Tour++ | Programming | D&E | bio | interviews | videos | quotes | applications | guidelines | compilers

Errata for A Tour of C++ (3rd edition)

Modified April 13, 2024.

Errata for Bjarne Stroustrup: A Tour of C++ (3rd edition), Addison-Wesley, 2022. ISBN 978-0-13-499783-4.

There seem to be a wide variety of opinion how much errata should be posted and how it should be presented. I have decided to post only errata that in my opinion may affect comprehension.

I do correct all typos and minor gramatical issues in future printings, and I may insert minor clarifications in the book. I just don't post them all as errata. All comment and corrections are welcome.

I often use the terse notation: s/old text/new text/

Thanks to all who reported problems.


Errors and clarifications to the 2nd printing

pg 128 and pg 136: /gsl::string_span/gsl::span<char>/

pg 247: we shouldn't pass pairs of pointer when we can use a span instead, so the example is better written as:

    double accum(span s, double init)
        // compute the sum of [beg:end) starting with the initial value init
    {
        return accumulate(s.begin(), s.end(), init);
    }

    double comp2(vector& v)
    {
        packaged_task pt0{ accum };							// package the task (i.e., accum)
        packaged_task pt1{ accum };

        future f0 {pt0.get_future()};					// get hold of pt0's future
        future f1 {pt1.get_future()};					// get hold of pt1's future

        double* first = &v[0];
        auto sz2 = v.size()/2;

        jthread t1{ move(pt0),span<double>{first,sz2},0};     		// start a thread for pt0
        jthread t2{ move(pt1),span<double>{first+sz2,sz2},0};		// start a thread for pt1
        // ...
        return f0.get() + f1.get();								// get the results
    }
        

pp278-279: s/algorithms/algorithm/ three times


Errors and clarifications to the 1st printing

pg 7: s/0x3.243F'6A88'85A3'08D3/0x1.921F'B544'42D1'8P+1/.

pg 44: s/0<i/0<=i/

pg 55: The copy constructor is not needed, and if it is supplied, it should be complex(const complex& z) :re{ z.re }, im{ z.im } {}.

pg 93: s/auto x/const auto& x/

pg104-105: s/Seq s/const Seq& s/ six times

pg105: s/range_value_t>/range_value_t/

pg 166: add an operator== to struct Record

pg 186: s/(r.begin(),end())/(r.begin(),r.end())/

pg 189: s/2 4 6 8 20/1 2 3 4 5 6 7 8 9 0/ pg 189: s/1 2 3/1 3 5/

pg 212: s/<string>/<string&>/

pg 214: s/00000000/100000000/

home | C++ | FAQ | technical FAQ | publications | WG21 papers | TC++PL | Tour++ | Programming | D&E | bio | interviews | videos | quotes | applications | guidelines | compilers