簡體   English   中英

boost :: shared_ptr錯誤

[英]boost::shared_ptr error

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&)' 

這是什么意思?

看起來您正在嘗試將EntityHolder類型的對象直接傳遞給shared_ptr的構造函數,但是應該為它提供一個指針,如下所示:

boost::shared_ptr<EntityHolder> p(new EntityHolder);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM