41页靠下有这样一段话:

《The C++ Standard Library》第41页 不要误解了这段话

这段话的意思是说不能把一个指针用assignment的方式直接赋给auto_ptr, 要用它的值来直接初始化。

而不是说auto_ptr不能用assignment的方式来初始化。

但是,auto_ptr用assignment的方式初始化的时候,只能用auto_ptr做为assignment的右边。下面的两个自已一个是用copy constructor的方式,另一个是用assignment的方式:

1. Copy constructor

《The C++ Standard Library》第41页 不要误解了这段话

2. assignment

《The C++ Standard Library》第41页 不要误解了这段话

相关文章:

  • 2021-07-17
  • 2021-10-02
  • 2021-10-14
  • 2021-10-10
  • 2022-02-08
  • 2022-12-23
  • 2021-06-05
  • 2021-08-11
猜你喜欢
  • 2021-08-20
  • 2021-05-31
  • 2021-11-26
  • 2021-11-20
  • 2021-11-03
  • 2022-01-25
  • 2022-12-23
相关资源
相似解决方案