Josuttis C++20  C++20 - The Complete Guide: Errata of First Edition

C++20 - The Complete Guide

Errata of the First Edition

November 14, 2022

This is the errata of the 1st printing of the book C++20 - The Complete Guide by Nicolai M. Josuttis.
It covers all errors that were found.

The errata is organized in the following way:
- The first part lists technical errors
- The second part lists typos

Usually the latest electronic version covers all issues of this errata.


Errors

Page 22, 1.6.1 Delegating Free-Standing Comparison Operators: 2022-11-14

The code for the feature test macro is missing:

#ifndef __cpp_impl_three_way_comparison
bool operator==(int i, const MyType& t) {
  return t == i; // OK with C++17
}
#endif


Typos

Page 4, 1.1.2 Defining Comparison Operators Since C++20

s/MyType a;/TypeA a;/
s/MyType b;/TypeB a;/

Page 19, 1.5.1 compare_three_way

s/ return std::compare_three_way{}(val<=>v.val); / return std::compare_three_way{}(val, v.val); /

Page 157-159, 6.5.1 Generic Code for Both Containers and Views

s/ const& Does Not Work for All Views / Declaring Range Parameters as const& Does Not Work for Some Views /

s/ // not callable for all views / // not callable for some views /   (4 times)

s/ Non-const && DoesWork for All Views / Declaring Range Parameters as Non-const && /

Page 222, 8.4.1 Iota View, ranges/iotaview.cpp

s/ auto iv3 = std::views::iota(1); // -2 -1 0 1 ... / auto iv3 = std::views::iota(1); // 1 2 3 4 ... /

Page 240, 8.4.6 Span

s/ underlying character sequence / underlying sequence of elements /

Page 240, 11.3.6 Hours Utilities

s/ std::chrono::make24(h, toPM) / std::chrono::make24(h, isPM) /

Page 631, 19.1 New Types for Non-Type Template Parameters

s/ or and lvalue reference type / or an lvalue reference type /

 


Home of the C++20 book