【发布时间】:2012-05-17 14:13:30
【问题描述】:
在下面一行
class Symbol : public boost::enable_shared_from_this<Symbol> {
我得到错误:
错误:不完整类型的无效使用struct boost::enable_shared_from_this<Symbol>
/usr/include/boost/smart_ptr/shared_ptr.hpp:63: 错误:struct boost::enable_shared_from_this<Symbol>的声明
知道为什么我会收到此错误。 Symbol 是一个抽象类(如果重要的话)
【问题讨论】:
-
我想将 shared_ptr 传递给
this给需要 boost::shared_ptr的函数。我使用了stackoverflow.com/questions/712279/… 的想法 -
@JerryCoffin:呃,它专门被设计成一个基类。
-
@CatPlusPlus:糟糕——非常正确。我想我应该在我跳进去之前看看......
标签: c++ shared-ptr