Pasing a 'auto_ptr' to a method



I would like to pass a variable pointer that has been instantiated using 'auto_ptr' to a class method, however, the compiler complains saying that it does not recognize the method call; gives me a number of options, basically the list of overloaded methods. So my question is, what is the proper way to pass 'auto_ptr('s)' to a method?
class MyClass{
   private: std::string str*
   public:
      MyClass(){ std::auto_ptr<std::string> str(new std::string("unknow"));}
      MyMethod(const std::string& s){ str = s;} // <== Error??
   ..........
}
 
main(){
   std::string temp*
   std::auto_ptr<std::string> tmp(new std::string("hey!"));}
   MyClass mc();
   mc.MyMethod(temp); // <<-- Error??
   ...
}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]