【发布时间】:2015-01-07 12:43:51
【问题描述】:
我想知道std::shared_ptr 没有为数组定义[] 运算符这一事实背后的基本原理是什么。特别是为什么std::unique_ptr 有这个运算符而不是std::shared_ptr?
【问题讨论】:
-
unique_ptr具有管理数组的专业化,shared_ptr没有。operator[]仅针对该专业提供。你是在问为什么shared_ptr没有那个? -
我希望这能回答你的问题stackoverflow.com/questions/8947579/…
-
@juanchopanza 我想我是。
标签: c++ c++11 shared-ptr unique-ptr