小编map*_*tts的帖子

这些shared_ptr实例之间的区别?

我对模板的体验并不是很好,而且我在团队的代码中发现了一些令我困惑的用法.

假设我有一个基类,它有以下两个用于shared_ptr的typedef:

class Foo
{
     virtual ~Foo();
     virtual void bar() = 0;
};

typedef boost::shared_ptr<Foo> FooPtr1;         //this is what i'm used to seeing
typedef boost::shared_ptr<class Foo> FooPtr2;   //this is in our codebase
Run Code Online (Sandbox Code Playgroud)

这些typedef之间有什么区别吗?它与派生类的使用有关吗?

c++ templates shared-ptr

0
推荐指数
1
解决办法
65
查看次数

标签 统计

c++ ×1

shared-ptr ×1

templates ×1