You are only allowed one implicit, user-defined conversion. Constructing an auto_ptr
from another one already involves the implicit conversion through an auxiliary auto_ptr_ref
class, and so you cannot implicitly construct your own class from an auto_ptr
.
By using direct initialization, one of the conversions is explicit, and only one implicit user-defined conversion remains, which is fine.
To "work around" the lack of implicit conversion, you can either modify your constructor to take the auto_ptr
by (non-const) reference, or migrate everything to unique_ptr
s.