boost :: shared_ptr错误

时间:2012-11-10 18:35:46

标签: c++ boost

class EntityHolder {
public:

    EntityHolder ( ) { }

    EntityHolder (
            const EntityHolder& other )  { }
    ~EntityHolder ( ) { }

    EntityHolder&
    operator = (
            const EntityHolder& other ) {
        return *this;
    } // =

当我尝试创建boost:shared_ptr时,我收到以下错误:

..\src\Entity.cpp:7:34: error: no matching function for call to 'boost::shared_ptr<orm::EntityHolder>::shared_ptr (orm::EntityHolder&)' 

这是什么意思?

1 个答案:

答案 0 :(得分:3)

看起来你正试图将EntityHolder类型的对象直接传递给shared_ptr的构造函数,但是你应该给它一个指针,如下所示:

boost::shared_ptr<EntityHolder> p(new EntityHolder);
相关问题