3

Hello I have this text from C++ primer 5th edition:

Explicit Destructor Invocation:

Just as placement new is analogous to using allocate, an explicit call to a destructor is analogous to calling destroy. We call a destructor the same way we call any other member function on an object or through a pointer or reference to an object:

  • Is it a mistake: "Just as placement new is analogous to using allocate" Did he mean analogous to construct not allocate?
Fantastic Mr Fox
  • 32,495
  • 27
  • 95
  • 175
Maestro
  • 2,512
  • 9
  • 24
  • 1
    Certainly doesn't read the right way around. – user4581301 Jun 17 '21 at 23:04
  • Not listed in the errata, but the errata I can find pretty damn old. – user4581301 Jun 17 '21 at 23:07
  • 2
    Assuming that this is talking about `std::allocator<>`, then yes, placement new is more analogous to `construct()` –  Jun 17 '21 at 23:07
  • 1
    10 years later is the 5th ed up to date enough to be considered a top-flight C++ text? Anyone done a a read-through of the 6th edition yet? – user4581301 Jun 17 '21 at 23:09
  • 2
    Related (sadly): [Is there an up to date errata for C++ Primer 5th Edition?](https://stackoverflow.com/questions/30863252/is-there-an-up-to-date-errata-for-c-primer-5th-edition) – alter_igel Jun 17 '21 at 23:13

0 Answers0