我有一个具有此功能的类:
typedef boost::shared_ptr<PrimShapeBase> sp_PrimShapeBase;
class Control{
public:
//other functions
RenderVectors(SDL_Surface*destination, sp_PrimShapeBase);
private:
//other vars
vector<sp_PrimShapeBase> LineVector;
};
//the problem of the program
void Control::RenderVectors(SDL_Surface*destination, sp_PrimShapeBase){
vector<sp_PrimShapeBase>::iterator i;
//iterate through the vector
for(i = LineVector.begin(); i != LineVector.end(); i ++ ){
//access a certain function of the class PrimShapeBase through the smart
//pointers
(i)->RenderShape(destination);
}
}
编译器告诉我 boost::shared_ptr 类没有名为“RenderShape”的成员,我觉得这很奇怪,因为 PrimShapeBase 类当然具有该功能,但位于不同的头文件中。这是什么原因?