[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
A question on 'auto_ptr'
From: |
address@hidden |
Subject: |
A question on 'auto_ptr' |
Date: |
Sat, 25 Aug 2007 06:08:58 -0700 |
User-agent: |
G2/1.0 |
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??
...
}
- A question on 'auto_ptr',
address@hidden <=