2010/2/23 Chard <boost@hazlewoods.eu>
[...]
>From smart_ptr/shared_ptr.hpp:
[A] template<class Y>
[B] explicit shared_ptr(std::auto_ptr<Y> & r): px(r.get()), pn()
By the way, shouldn't this constructor take std::auto_ptr by value instead of by reference. I remember being forced to introduce a local variable with the example below (was with sunstudio 12, default STL if I remember correctly). I think this was caused because you can not bind a temporary object to a non const reference.
struct T {};
std::auto_ptr<T> factory();
void failedCompile() {
boost::shared_ptr<T> p( factory() );
}
// Needed to be modified as:
void compile() {
std::auto_ptr<T> temp = factory();
boost::shared_ptr<T> p( temp );
}
Baptiste.