C++核心准则 讨论:“原始”指针或引用绝对不是资源句柄

2020-12-31 14:53:50 浏览数 (1)

Discussion: A "raw" pointer or reference is never a resource handle

讨论:“原始”指针或引用绝对不是资源句柄

Reason(原因)

To be able to distinguish owners from views.

为了能够从各种表现中区分所有者。

Note(注意)

This is independent of how you "spell" pointer : T*, T&, Ptr<T> and Range<T> are not owners.

这与“拼写”指针的方式无关:T *,T&,Ptr <T>和Range <T>都不是所有者。

原文链接

https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#discussion-a-raw-pointer-or-reference-is-never-a-resource-handle

0 人点赞