Value Semantics、Copy / Move 与 STL 元素类型 | STL

本章覆盖:value semantics;CopyConstructible / MoveConstructible 的历史要求认知;move-only type;`unique_ptr` 进入容器;copy / move cost;container relocation;noexcept move;emplace 与对象构造;STL 使用者必须理解对象生命周期;类型能力决定某些容器 / 算法操作是否可用。

本章知识点

  • value semantics
  • CopyConstructible / MoveConstructible 的历史要求认知
  • move-only type
  • unique_ptr 进入容器
  • copy / move cost
  • container relocation
  • noexcept move
  • emplace 与对象构造
  • STL 使用者必须理解对象生命周期
  • 类型能力决定某些容器 / 算法操作是否可用