i have a class that has this function:
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); 
    }
}
The compiler tells me that the class boost::shared_ptr has no member called 'RenderShape' which I find bizarre since the class PrimShapeBase certainly has that function but is in a different header file. What is the cause of this?
Don't you mean
(*i)->RenderShape(destination); 
?
i is the iterator, *i is the shared_ptr, (*i)::operator->() is the object.
That's because i is an iterator.  Dereferencing it once gives you the smart pointer, you need to double dereference it.
(**i).RenderShape(destination);
or
(*i)->RenderShape(destination); 
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With