As I understand it, if I have a class that has a boost::scoped_ptr member variable, and if I were to copy an instance of that class and would like the new instance to have its scoped_ptr member point to a copy of what the first instance pointed to, I would have to implement a custom copy constructor (and assignment operator) and make the deep copying explicitly of whatever the scoped_ptr points to. It would be great if the smart pointer type had a copy constructor that did this itself.
Are there no similar smart pointers in c++ boost / stl libraries that already has the deep copy functionality built in, so that when the smart pointer is copied the object it points to is also copied? At least as an option?
(If there was such a pointer, in my case the pointer would have to know a bit more about how it should create the new object since my objects pointed to are of polymorphic classes, with virtual Clone() functions. If the smart pointer couldn't implicitly figure out how to deep copy, the client code could have supplied a function pointer or something pointing to the Clone function or whatever factory creation function should be used. I guess this complication of how the new object could created that might be one of the reasons why no pointer has the deep copy functionality after all..?)