The problem is that std::auto_ptr does not have a "standard copy constructor".
The prototype for auto_ptr
copy is
auto_ptr(auto_ptr&)
(note the non const parameter).
You are passing a
const
to something that is designed to modify it.
The proper way to do this is having a
my_autoptr(myautoptr& s) :auto_ptr(s) {}
my_autoptr(typename auto_ptr::ref s) :auto_ptr(s) {}
Note: auto_ptr doesn't have virtual methods, so don't use
auto_ptr
and
my_autoptr
polymorphicaly.