相关疑难解决方法(0)

为什么shared_ptr <void>合法,而unique_ptr <void>是不正确的?

问题确实符合标题:我很想知道这种差异的技术原因是什么,还有理由?

std::shared_ptr<void> sharedToVoid; // legal;
std::unique_ptr<void> uniqueToVoid; // ill-formed;
Run Code Online (Sandbox Code Playgroud)

c++ smart-pointers shared-ptr unique-ptr

89
推荐指数
2
解决办法
1万
查看次数

标签 统计

c++ ×1

shared-ptr ×1

smart-pointers ×1

unique-ptr ×1