小编Rad*_*ska的帖子

c ++ 11 - 指针检查的性能差异 - 智能指针

测试智能指针(例如shared_ptr)之间有什么区别吗? operator bool

if (!smart_ptr)
{
    // ...
}
Run Code Online (Sandbox Code Playgroud)

和使用operator ==

if (smart_ptr == nullptr)
{
    // ...
}
Run Code Online (Sandbox Code Playgroud)

我知道差异很小(如果有的话),但它也可以帮助同时决定编码风格.

c++ coding-style c++11

3
推荐指数
1
解决办法
195
查看次数

标签 统计

c++ ×1

c++11 ×1

coding-style ×1