user14416
user14416

Reputation: 3032

boost::shared_ptr error

class EntityHolder {
public:

    EntityHolder ( ) { }

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

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

When I am trying to create boost:shared_ptr, I get the following error:

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

What does this mean?

Upvotes: 0

Views: 101

Answers (1)

Joseph Mansfield
Joseph Mansfield

Reputation: 110748

Looks like you're trying to pass an object of type EntityHolder directly to the constructor of the shared_ptr, but you're supposed to give it a pointer, like so:

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

Upvotes: 3

Related Questions