Jump to content
  • Advertisement
Sign in to follow this  
Concentrate

A little trouble compiling boost::shared_ptr

This topic is 2549 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

This is my cell class

class Cell
{
public:
typedef boost::shared_ptr<IShape> ShapePtr;
private:
ShapePtr cellShape;
bool visited;
public:
Cell(): visited(false){}
Cell(boost::shared_ptr<IShape>& shape): cellShape(shape), visited(false)
{
}
public:
static ShapePtr createRectangularCell(){
return ShapePtr( new Rectangle() );
}
static ShapePtr createRectangularCell(float x, float y ,float z){
return ShapePtr( new Rectangle(x,y,z) );
}
static ShapePtr createRectangularCell(float x, float y , float z,
Dimension::DimensionType width,
Dimension::DimensionType height,
Dimension::DimensionType depth = 0){
return ShapePtr( new Rectangle(x,y,z,width,height,depth));
}
static ShapePtr createRectangularCell(const sf::Vector3f& position, const Dimension& dimension){
return ShapePtr( new Rectangle(position,dimension));
}
static ShapePtr createCubeWallCell(){
return ShapePtr( new Cube() );
}
static ShapePtr createCubeWallCell(float x, float y, float z){
return ShapePtr( new Cube(x,y,z) );
}
static ShapePtr createCubeWallCell(float x, float y, float z,
Dimension::DimensionType width,
Dimension::DimensionType height,
Dimension::DimensionType depth = 1){
return ShapePtr( new Cube(x,y,z,width,height,depth));
}
static ShapePtr createCubeWallCell(const sf::Vector3<float>& position, const Dimension& dimension){
return ShapePtr( new Cube(position,dimension) );
}

};


The compiler is having trouble with the bolded part above. Here is the error.

Call to deleted constructor of 'ShapePtr' (aka 'shared_ptr<IShape>')

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!