On Sat, 2007-08-25 at 06:08 -0700, [EMAIL PROTECTED] wrote:
> 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;
You have to know that Auto-pointers are class objects, not scalar
pointers. They might look like pointers while using them, but they
aren't. If you want to declare a function which takes an auto_pointer,
then declare the function's arguments as auto_ptr<T> object, where "T"
is some specific type or a template type.
> main(){
> std::string temp*
> std::auto_ptr<std::string> tmp(new std::string("hey!"));}
> MyClass mc();
> mc.MyMethod(temp); // <<-- Error??
> ...
> }
Did you realize that "temp" in main is a pointer, and MyMethod is
expecting a reference ? Besides, what does "temp" has to do with
Auto-pointers, isn't it just a regular pointer !!
Cheers,
--
John V. Shahid <[EMAIL PROTECTED]>
_______________________________________________
help-gplusplus mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gplusplus