
Thorsten Ottosen <thorsten.ottosen@dezide.com> writes:
It is better that new_<T>(...) produces an unspecified type that has a templated conversion operator, eg.:
template< class T > struct new_return { std::auto_ptr<T> new_;
new_return( T* new_ ) : new_(new_) { }
template< class SP > operator SP() const { return SP( new_.release() ); }
operator std::auto_ptr<T>() const { return new_; } };
Or something
I started down that road, but unfortunately, there's nothing to keep the operator SP conversion from converting to raw pointers. ;-) I don't see why Peter is the only one who seems to be responding to the auto_ptr rvalue implicit conversion technique. It just works. -- Dave Abrahams Boost Consulting www.boost-consulting.com