[Dev-C++] Pasing a 'auto_ptr' to a method
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Jamiil A. <jal...@gm...> - 2007-08-25 13:01:41
|
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:=20
MyClass(){ std::auto_ptr<std::string> str(new =
std::string("unknow"));}
MyMethod(const std::string& s){ str =3D s;} // <=3D=3D Error??
..........
}
main(){
std::string temp*
std::auto_ptr<std::string> tmp(new std::string("hey!"));}
MyClass mc();
mc.MyMethod(temp); // <<-- Error??
...
} |